R. David Murray <[email protected]> added the comment:
It looks to me like MIMEText doesn't actually support unicode input. .
One way to get the example to work is to do this:
MIMEText(u'\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430'.encode('utf-8'),
'plain', 'utf-8')
The above call produces valid output from as_string:
'Content-Type: text/plain; charset="utf-8"\nMIME-Version:
1.0\nContent-Transfer-Encoding: base64\n\n0LrQuNGA0LjQu9C40YbQsA==\n'
How you'd get it to use 8bit, I have no idea. Still, I'm inclined to
close this as invalid unless Barry tells me my analysis is wrong.
(CF: http://mg.pov.lt/blog/unicode-emails-in-python for a good example
of handling unicode using the email package, which I found after
figuring out the above.)
Clearly, the documentation of this could be better, but I suspect the
developers would rather spend their time fixing the email module in py3.
A doc patch would certainly be accepted. (Maybe someone could ask the
above blogger if we could borrow his example for the docs.)
----------
nosy: +r.david.murray
resolution: -> invalid
stage: -> committed/rejected
status: open -> pending
type: -> behavior
versions: +Python 2.6, Python 2.7, Python 3.0, Python 3.1
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1368247>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com