summaryrefslogtreecommitdiffstats
path: root/Lib/email/test
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-02-05 15:49:49 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-02-05 15:49:49 (GMT)
commitf581b372003de0ae604c14a1f1dc2e8c36ea277b (patch)
treeed6202c27c0c8f2fb739acdfa6e3b6eaaed620d2 /Lib/email/test
parent43536e9e373f395a047403831c08acedf3c5f258 (diff)
downloadcpython-f581b372003de0ae604c14a1f1dc2e8c36ea277b.zip
cpython-f581b372003de0ae604c14a1f1dc2e8c36ea277b.tar.gz
cpython-f581b372003de0ae604c14a1f1dc2e8c36ea277b.tar.bz2
#16948: Fix quopri encoding of non-latin1 character sets.
Diffstat (limited to 'Lib/email/test')
-rw-r--r--Lib/email/test/test_email.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 352b9b1..2fa4aa8 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -670,6 +670,27 @@ class TestEncoders(unittest.TestCase):
msg = MIMEText('文', _charset='euc-jp')
eq(msg['content-transfer-encoding'], '7bit')
+ def test_qp_encode_latin1(self):
+ msg = MIMEText('\xe1\xf6\n', 'text', 'ISO-8859-1')
+ self.assertEqual(str(msg), textwrap.dedent("""\
+ MIME-Version: 1.0
+ Content-Type: text/text; charset="iso-8859-1"
+ Content-Transfer-Encoding: quoted-printable
+
+ =E1=F6
+ """))
+
+ def test_qp_encode_non_latin1(self):
+ # Issue 16948
+ msg = MIMEText('\u017c\n', 'text', 'ISO-8859-2')
+ self.assertEqual(str(msg), textwrap.dedent("""\
+ MIME-Version: 1.0
+ Content-Type: text/text; charset="iso-8859-2"
+ Content-Transfer-Encoding: quoted-printable
+
+ =BF
+ """))
+
# Test long header wrapping
class TestLongHeaders(TestEmailBase):