[Python-Dev] iso-2022 and issue 7472: question for the experts

"Martin v. Löwis" martin at v.loewis.de
Wed Apr 7 02:18:13 CEST 2010


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

Refute, see http://bugs.python.org/issue804885

> ISO-2022 input will
> be 7-bit, and the except will not trigger

This conclusion is false:

1. it is 7-bit

py> unichr(913).encode("iso-2022-jp")
'\x1b$B&!\x1b(B'

2. the except *will* trigger, anyway.

py> unichr(913).encode("ascii")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0391' in
position 0: ordinal not in range(128)

This issue doesn't get noticed, because it doesn't hurt today's email
readers and MTAs to process 8-bit MIME, even if 7-bit had been
sufficient.

HTH,
Martin

P.S. Notice that Tokio's original patch had the spelling right.


More information about the Python-Dev mailing list