[issue9124] Mailbox module should use binary I/O, not text I/O

R. David Murray report at bugs.python.org
Fri Jan 28 20:38:03 CET 2011


R. David Murray <rdmurray at bitdance.com> added the comment:

I'm updating the patch to contain a couple tests using non-ASCII.  More are needed.

Before this patch, one could process a file containing non-ASCII characters as text, and if your default encoding happened to be able to decode it, things would appear to more or less work.  In real life doing this is most likely to produce mojibake.  So the patch now rejects string input that contains non-ASCII characters with a helpful message about using bytes or Message input.  Email doesn't handle messages in string format that contain non-ASCII characters, either (which, I think, was the source of the error Steffen encountered).  This means that the string backward-compatibility is reduced to ascii-only messages.  But if mailbox in py3 is being used successfully by anybody, it is most likely to be someone processing ascii only messages for some reason.

----------
Added file: http://bugs.python.org/file20579/mailbox3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9124>
_______________________________________


More information about the Python-bugs-list mailing list