human_readable = cool_library.decode_equals(message['Subject'])
Thank you, Dan
parts = email.Header.decode_header(header)
new_header = email.Header.make_header(parts)
human_readable = unicode(new_header)
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
That's RFC 2047 encoding, both examples introduce an ISO8859-2
string, the first variant says it's ascii-ized using
"Q"uoted-Printable, the other says the string is "B"ase64-encoded.
> Is there a python library function to decode such a
> subject, returning a unicode string? The use would be like
>
> human_readable = cool_library.decode_equals(message['Subject'])
quoting from http://docs.python.org/lib/module-email.Header.html
>>> from email.Header import decode_header
>>> decode_header('=?iso-8859-1?q?p=F6stal?=')
[('p\xf6stal', 'iso-8859-1')]
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
Here is some code from a front end to Mailman moderation pages:
import email.Header
hdr = email.Header.make_header(email.Header.decode_header(sub))
Neil