diff options
author | R David Murray <rdmurray@bitdance.com> | 2011-03-15 01:14:53 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2011-03-15 01:14:53 (GMT) |
commit | 7d9129c147beaff342d418a4857177778dd1841d (patch) | |
tree | e4a2265dd1372d5b14c5a84152ba64f3c342b001 /Lib/email/test | |
parent | a9b3a1c49d584fddf47f0c3befc818fcb124cb96 (diff) | |
parent | 3a6152f3b3346f00371faad8fc8a9cfb3085682f (diff) | |
download | cpython-7d9129c147beaff342d418a4857177778dd1841d.zip cpython-7d9129c147beaff342d418a4857177778dd1841d.tar.gz cpython-7d9129c147beaff342d418a4857177778dd1841d.tar.bz2 |
Merge long Japanese header fix from 3.2.
Diffstat (limited to 'Lib/email/test')
-rw-r--r-- | Lib/email/test/test_email.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 5aaf526..f2d5210 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -725,6 +725,20 @@ wasnipoop; giraffes="very-long-necked-animals"; wasnipoop; giraffes="very-long-necked-animals"; \tspooge="yummy"; hippos="gargantuan"; marshmallows="gooey"''') + def test_header_encode_with_different_output_charset(self): + h = Header('文', 'euc-jp') + self.assertEqual(h.encode(), "=?iso-2022-jp?b?GyRCSjgbKEI=?=") + + def test_long_header_encode_with_different_output_charset(self): + h = Header(b'test-ja \xa4\xd8\xc5\xea\xb9\xc6\xa4\xb5\xa4\xec\xa4' + b'\xbf\xa5\xe1\xa1\xbc\xa5\xeb\xa4\xcf\xbb\xca\xb2\xf1\xbc\xd4' + b'\xa4\xce\xbe\xb5\xc7\xa7\xa4\xf2\xc2\xd4\xa4\xc3\xa4\xc6\xa4' + b'\xa4\xa4\xde\xa4\xb9'.decode('euc-jp'), 'euc-jp') + res = """\ +=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKMnE8VCROPjUbKEI=?= + =?iso-2022-jp?b?GyRCRyckckJUJEMkRiQkJF4kORsoQg==?=""" + self.assertEqual(h.encode(), res) + def test_header_splitter(self): eq = self.ndiffAssertEqual msg = MIMEText('') |