# [EMAIL PROTECTED] / 2005-04-20 00:30:35 -0700:
> 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?=.

    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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to