Decoding 'funky' e-mail subjects
Skip Montanaro
skip at pobox.com
Mon Jun 7 15:04:56 EDT 2004
>> Have you tried decode_header from email.Header in the python
>> email-package?
Jonas> Thanks, that works. The problem is that I need to make it
Jonas> compatible with Python 1.5.2.
Why not just include email.Header.decode_header() in your app? Something
like:
try:
from email.Header import decode_header
except ImportError:
# Python 1.5.2 compatibility...
def decode_header(...):
...
If that proves to be intractible, define yours when an ImportError is
raised. In either case, you get the best solution when you can and only
fall back to something possibly suboptimal when necessary.
Skip
More information about the Python-list
mailing list