summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-02-05 16:34:39 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-02-05 16:34:39 (GMT)
commitc44911f49aeb0cdb54f006f99111b562b29fc46f (patch)
tree0af78d63398d01f122b7dbdf947639c925919114 /Lib/test/test_email
parent0b6119e478a98b35dbd40354e4f5826108b8ce87 (diff)
parente201e9d584e2922997eeacad06ee6e84a6419d08 (diff)
downloadcpython-c44911f49aeb0cdb54f006f99111b562b29fc46f.zip
cpython-c44911f49aeb0cdb54f006f99111b562b29fc46f.tar.gz
cpython-c44911f49aeb0cdb54f006f99111b562b29fc46f.tar.bz2
Merge: #16948: Fix quopri encoding of non-latin1 character sets.
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r--Lib/test/test_email/test_email.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index 36c344f..da7cb53 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -677,6 +677,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):