[issue42433] mailbox.mbox fails on non ASCII characters

R. David Murray report at bugs.python.org
Sun Nov 22 14:18:58 EST 2020


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

The problem with that archive is that it is not in proper mbox format.  It contains the following line (5689):

    From here I was hoping to run something like “dbus-send –system –dest=Test.Me –print-reply /Japan Japan.Reset.Test string:”Hello””

You will note that there is no leading '>' on that line to escape that 'From '.  So mbox tries to build a 'From ' line from it, and fails because 'From ' lines should not contain any non-ascii characters.  It can be argued that that failure is sub-optimal...it should probably be calling decode('ascii', errors='replace') so that the parse doesn't fail, just like it would not fail if there were no non-ascii in the unescaped 'From ' line.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42433>
_______________________________________


More information about the Python-bugs-list mailing list