diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-01-13 13:19:21 -0500 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-01-13 13:19:21 -0500 |
commit | 5f31fd07d88f8912759632e38f20dc1bb078f3a0 (patch) | |
tree | 9a66c9a043a7b78c51735bda82257ef7683f98d9 /Lib/test/test_email/test_email.py | |
parent | 74815184c325de5a2a9ccb6bdd9a1900bf4ba8bf (diff) | |
download | cpython-5f31fd07d88f8912759632e38f20dc1bb078f3a0.tar.gz |
#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.
Diffstat (limited to 'Lib/test/test_email/test_email.py')
-rw-r--r-- | Lib/test/test_email/test_email.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py index 6af62788a6..c787695e12 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -4216,6 +4216,11 @@ class TestQuopri(unittest.TestCase): def test_encode_one_line_eol(self): self._test_encode('hello\n', 'hello\r\n', eol='\r\n') + def test_encode_one_line_eol_after_non_ascii(self): + # issue 20206; see changeset 0cf700464177 for why the encode/decode. + self._test_encode('hello\u03c5\n'.encode('utf-8').decode('latin1'), + 'hello=CF=85\r\n', eol='\r\n') + def test_encode_one_space(self): self._test_encode(' ', '=20') |