To decode the Subject =?iso-8859-2?Q?=... in email in python
Neil Hodgson
nyamatongwe+gravity at gmail.com
Wed Apr 20 09:17:15 EDT 2005
Dan Polansky:
> When parsing messages using python's libraries email and mailbox, the
> subject is often encoded using some kind of = notation. Apparently, the
> encoding used in this notation is specified like =?iso-8859-2?Q?=... or
> =?iso-8859-2?B?=. 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'])
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
More information about the Python-list
mailing list