Unicode - and MIMEType - Good friday fun.

rh0dium steven.klass at gmail.com
Sat Sep 12 01:33:42 CEST 2009


Hi Geniuses,

Can anyone please show me the way..  I don't understand why this
doesn't work...


# encoding: utf-8
from email.MIMEText import MIMEText

msg = MIMEText("hi")
msg.set_charset('utf-8')
print msg.as_string()

a = 'Ho\xcc\x82tel Ste\xcc\x81phane '
b = unicode(a, "utf-8")

print b

msg = MIMEText(b)
msg.set_charset('utf-8')
print msg.as_string()

It should right??

Thanks!



More information about the Python-list mailing list