character set gobbledy-gook ascii translation ...

Darran Edmundson darran.edmundson at anu.edu.au
Fri Dec 24 15:11:16 CET 2004


I'm parsing a file with the mailbox and email modules and
come across subject headers like:
    =?us-ascii?Q?Re=3A=20=5Bosg=2Duser=5D=20Culling=20problem?=
and
    =?gb2312?B?cXVlc3Rpb24gYWJvdXQgbG9hZGluZyBmbHQgbGFyZ2UgdGVycmFpbiA=?=

I've looked at the Charset class but can't figure out how to use it to
convert the above strings to a human readable form.  Generally, I 
imagine that
there is no guarantee that an encoded string can be rendered meaningfully
in ASCII - but these are posts to an English language mai list so it should
be possible for this restricted case.

I can guess the translation in the first example above but I'm
hoping there is a Python module that'll do it for me.

Any help is much appreciated.

Cheers,
Darran.



More information about the Python-list mailing list