Message87292
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.) |
|
Date |
User |
Action |
Args |
2009-05-05 21:54:34 | r.david.murray | set | recipients:
+ r.david.murray, loewis, barry, vstinner, gdamjan, maxua, bgamari |
2009-05-05 21:54:34 | r.david.murray | set | messageid: <1241560474.39.0.817323999163.issue1368247@psf.upfronthosting.co.za> |
2009-05-05 21:54:33 | r.david.murray | link | issue1368247 messages |
2009-05-05 21:54:32 | r.david.murray | create | |
|