SIGN IN SIGN UP

#20206, #5803: more efficient algorithm that doesn't truncate output.

This fixes an edge case (20206) where if the input ended in a character
needing encoding but there was no newline on the string, the last byte
of the encoded character would be dropped.  The fix is to use a more
efficient algorithm, provided by Serhiy Storchaka (5803), that does not
have the bug.
R
R David Murray committed
2313e15578aa864c7b995de996e4787169f7ca8d
Parent: 2a3d7d1