[issue11243] email/message.py str conversion

R. David Murray report at bugs.python.org
Thu Mar 17 01:17:32 CET 2011


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

Steffen, what you are doing in 11243-test is not something that the current email package supports.  String input to message_as_string must be ASCII only in email 5.1/python3.2.  Likewise for decode_header.  To get unicode in to a header, you have to pass it in to the constructor of Header, and then it encodes it as an encoded word in whatever character set you tell it to use.

The make_header(decode_header(stuff)) would theoretically return stuff, except that as you can see if stuff is non-ascii (or a Header), it won't work.  If you are handling 'dirty' data, you have to stick to the binary interfaces, as discussed.  Header needs a binary interface, but it doesn't have one (yet?).

Yes, this interface is not an optimal interface.  That's what email6 is about :)

So, absent a minimal failing test case, I'm going to commit the patch.

----------

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


More information about the Python-bugs-list mailing list