aboutsummaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-05-06 01:41:14 +0000
committerR. David Murray <rdmurray@bitdance.com>2010-05-06 01:41:14 +0000
commite85200d5554893389bd81b1cf58e01e894588529 (patch)
tree6a12171c2f4c005a9c0d0a65246cc1517383c7a8 /Lib
parent71adcac1a2609e308f887badf888d07195ffa695 (diff)
downloadcpython3-e85200d5554893389bd81b1cf58e01e894588529.tar.gz
Merged revisions 80800 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk It turns out that email5 (py3k), because it is using unicode for the payload, doesn't do the encoding to the output character set until later in the process. Specifically, charset.body_encode no longer does the input-to-output charset conversion. So the if test in the exception clause in encoders.encode_7or8bit really is needed in email5. So, this merge only merges the test, not the removal of the 'if'. ........ r80800 | r.david.murray | 2010-05-05 13:31:03 -0400 (Wed, 05 May 2010) | 9 lines Issue #7472: remove unused code from email.encoders.encode_7or8bit. Yukihiro Nakadaira noticed a typo in encode_7or8bit that was trying to special case iso-2022 codecs. It turns out that the code in question is never used, because whereas it was designed to trigger if the payload encoding was eight bit but its output encoding was 7 bit, in practice the payload is always converted to the 7bit encoding before encode_7or8bit is called. Patch by Shawat Anand. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/test/test_email.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 2cf1a0a264..6793df50c6 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -530,6 +530,13 @@ class TestEncoders(unittest.TestCase):
msg = MIMEText('hello \xf8 world', _charset='iso-8859-1')
eq(msg['content-transfer-encoding'], 'quoted-printable')
+ def test_encode7or8bit(self):
+ # Make sure a charset whose input character set is 8bit but
+ # whose output character set is 7bit gets a transfer-encoding
+ # of 7bit.
+ eq = self.assertEqual
+ msg = MIMEText('\xca\xb8', _charset='euc-jp')
+ eq(msg['content-transfer-encoding'], '7bit')
# Test long header wrapping