Internationalised email subjects

bugmagnet at gmail.com bugmagnet at gmail.com
Fri Jun 22 03:15:38 EDT 2007


Thanks Martin,

The "Some Chinese characters" are loaded from a MySQL table and are
encoded in GB2312 format.

I've added the following line at the top of the code:

# -*- coding: GB2312 -*-

I've also added the following line into the code:

h = Header(subject.encode('GB2312'), 'GB2312')

Note that the 'subject' variable consists of GB2312 encoded text, so I
am not sure if it is necessary to call the subject.encode('GB2312')
method.  When I try to execute this code, I get the following error:

File "/home/web88/html/app/test.py", line 17,
in Header(subject.encode('GB2312'), 'GB2312')
LookupError: unknown encoding: GB2312

Any idea what may be wrong?





More information about the Python-list mailing list