[issue11243] email/message.py str conversion

Steffen Daode Nurpmeso report at bugs.python.org
Wed Mar 16 12:47:18 CET 2011


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

On Tue, Mar 15, 2011 at 04:21:24AM +0000, R. David Murray wrote:
> Please test and let me know if it works

Spending some more time on that, continuing yesterdays session 
where i got stuck. When i instead do (still in 
header.py:Header.append()):

        # Steffen is out now again
        if isinstance(s, Header):
            s = str(s)
            errors = 'replace'

Traceback (most recent call last):
  File "/Users/steffen/usr/bin/s-postman.py", line 1212, 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 144, in _write
    self._write_headers(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 363, in _write_headers
    self.write(v.encode(maxlinelen=self._maxheaderlen)+NL)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 320, in encode
    formatter.feed(lines[0], charset)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 386, in feed
    encoded_string = charset.header_encode(string)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/charset.py", line 296, in header_encode
    header_bytes = _encode(string, codec)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/charset.py", line 163, in _encode
    return string.encode(codec)
Exception: UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 7: ordinal not in range(128)

I've updated and am at db73857.
And i am *really* looking forward for 'defects'.

----------

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


More information about the Python-bugs-list mailing list