On Apr 11, 10:16 am, "erikcw" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm trying to parse an email message, but am running into this > exception. > > Traceback (most recent call last): > File "wa.py", line 336, in ? > main() > File "wa.py", line 332, in main > print out['msg'] > UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in > position 238: ordinal not in range(128) > > How can I decode/encode this string to print to stdout and send again > in another email? Do I have to know what language the email is in? > > Thanks! > Erik
You'll need to do some encoding/decoding work. Check out the following links on unicode: http://www.reportlab.com/i18n/python_unicode_tutorial.html http://www.amk.ca/python/howto/unicode http://www.jorendorff.com/articles/unicode/python.html And here's a few links on parsing: http://docs.python.org/api/arg-parsing.html http://www.diveintopython.org/xml_processing/unicode.html Probably more information than you need, but it should help answer your question (and maybe any future questions about Unicode). Mike -- http://mail.python.org/mailman/listinfo/python-list