Author r.david.murray
Recipients barry, bgamari, gdamjan, loewis, maxua, r.david.murray, vstinner
Date 2009-05-05.21:54:32
SpamBayes Score 1.08599e-05
Marked as misclassified No
Message-id <>
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: 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:34r.david.murraysetrecipients: + r.david.murray, loewis, barry, vstinner, gdamjan, maxua, bgamari
2009-05-05 21:54:34r.david.murraysetmessageid: <>
2009-05-05 21:54:33r.david.murraylinkissue1368247 messages
2009-05-05 21:54:32r.david.murraycreate