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

Steffen Daode Nurpmeso report at bugs.python.org
Fri Jan 28 22:33:45 CET 2011


Steffen Daode Nurpmeso <sdaoden at googlemail.com> added the comment:

I missed your mailbox3.patch, but now i've merged it in.
One error changed, it now happens when a re.search is applied to a header value and thus seems to match what you say.  I'm not able to understand this error this evening, but i will review it once again tomorrow and will notify this issue if it seems to me it's something different than what you say.
The other error almost remains the same from my point of view, again, i'm out today, but here i'll add the traceback again.

... as before ...
  File "s-postman.py", line 685, in add_ticket
    mbox.add(ticket.get_msg())
  File "/Users/steffen/usr/lib/python3.2/mailbox.py", line 269, in add
    self._dump_message(message, tmp_file)
  File "/Users/steffen/usr/lib/python3.2/mailbox.py", line 215, in _dump_message
    gen.flatten(message)
  File "/Users/steffen/usr/lib/python3.2/email/generator.py", line 88, in flatten
    self._write(msg)
  File "/Users/steffen/usr/lib/python3.2/email/generator.py", line 141, in _write
    self._write_headers(msg)
  File "/Users/steffen/usr/lib/python3.2/email/generator.py", line 372, in _write_headers
    header_name=h)
  File "/Users/steffen/usr/lib/python3.2/email/header.py", line 197, in __init__
    self.append(s, charset, errors)
  File "/Users/steffen/usr/lib/python3.2/email/header.py", line 275, in append
    s.encode(output_charset, errors)
UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 8: ordinal not in range(128)

----------

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


More information about the Python-bugs-list mailing list