A long time ago (in a galaxy far far...no, wrong show)

Er, as I was saying, a long time ago Barry applied a patch to
email that went more or less like this:

ndex: email/Encoders.py
===================================================================
--- email/Encoders.py   (revision 35918)
+++ email/Encoders.py   (revision 35919)
@@ -84,7 +83,13 @@
     try:
         orig.encode('ascii')
     except UnicodeError:
-        msg['Content-Transfer-Encoding'] = '8bit'
+        # iso-2022-* is non-ASCII but still 7-bit
+        charset = msg.get_charset()
+        output_cset = charset and charset.output_charset
+        if output_cset and output_cset.lower().startswith('iso-2202-'):
+            msg['Content-Transfer-Encoding'] = '7bit'
+        else:
+            msg['Content-Transfer-Encoding'] = '8bit'
     else:
         msg['Content-Transfer-Encoding'] = '7bit'


Nobody noticed the typo (2202 instead of 2022) until Yukihiro reported
it in the issue.  No one has complained about the code not working.
There are no unit tests that cover the code (all tests pass with or
without the patch, and alternatively with or without correcting the typo).

Reading the standards, it looks to me like either the ISO-2022 input will
be 7-bit, and the except will not trigger, or it will be invalid, because
8bit, and so should be set to 8bit just like all the other cases where
there's invalid 8bit data.  So I think this patch should just be reverted.

Can someone (Steve Turnbull?) confirm or refute my analysis? 

--
R. David Murray                                      www.bitdance.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to