[New-bugs-announce] [issue11605] EMail generator.flatten() disintegrates over UTF-8 multipart/alternative

Steffen Daode Nurpmeso report at bugs.python.org
Sat Mar 19 11:55:56 CET 2011


New submission from Steffen Daode Nurpmeso <sdaoden at googlemail.com>:

Hi David, i'm having real problems here!
Got a multipart mail and i get this:

______
Traceback (most recent call last):
  File "/Users/steffen/usr/bin/s-postman.py", line 1239, in save_ticket
    mb.add(ticket.message())
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 279, in add
    self._dump_message(message, tmp_file)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 215, in _dump_message
    gen.flatten(message)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 91, in flatten
    self._write(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 137, in _write
    self._dispatch(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 163, in _dispatch
    meth(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 224, in _handle_multipart
    g.flatten(part, unixfrom=False, linesep=self._NL)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 91, in flatten
    self._write(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 137, in _write
    self._dispatch(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 163, in _dispatch
    meth(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 388, in _handle_text
    super(BytesGenerator,self)._handle_text(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 201, in _handle_text
    self.write(payload)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 349, in write
    self._fp.write(s.encode('ascii', 'surrogateescape'))
Exception: UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 21: ordinal not in range(128)
______

I'll attach that mail.  I don't know wether your version of
my postman reproduces it (though it should, but hey, it's broken!),
i'm using tag 0.4.0a1 (revision 420fcd870797).
I would be thankful for a hint on what this is and how i can
avoid this.

----------
components: Library (Lib)
files: generator_booom.mbox
messages: 131406
nosy: r.david.murray, sdaoden
priority: normal
severity: normal
status: open
title: EMail generator.flatten() disintegrates over UTF-8 multipart/alternative
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file21288/generator_booom.mbox

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


More information about the New-bugs-announce mailing list