diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -3451,7 +3451,7 @@ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 - 0JTQsCwg0L7QvdC4INC70LXRgtGP0YIuCg== + 0JTQsCwg0L7QvdC4INC70LXRgtGP0YIuDQo= """) def test_generator_handles_8bit(self): @@ -4075,6 +4075,12 @@ CharsetModule.add_charset('fake', CharsetModule.QP, None, 'utf-8') c = Charset('fake') eq('hello world', c.body_encode('hello world')) + # Test for issue #975330. Replacing \r or \n with \r\n. + from email.base64mime import decode as base64decode + c = Charset() + c.body_encoding = 2 + eq(b'hello\r\n world', base64decode(c.body_encode('hello\r world'))) + eq(b'hello\r\n world\r\n', base64decode(c.body_encode('hello\r world\n'))) def test_unicode_charset_name(self): charset = Charset('us-ascii')