How do I decode unicode characters in the subject using email.message_from_string()?

Steve Holden steve at holdenweb.com
Wed Feb 25 10:24:17 EST 2009


rdmurray at bitdance.com wrote:
> Steve Holden <steve at holdenweb.com> wrote:
>>>>> from email.header import decode_header
>>>>> print
>> decode_header("=?us-ascii?Q?Inteum_C/SR_User_Tip:__Quick_Access_to_Recently_Opened_Inteu?=\r\n\t=?us-ascii?Q?m_C/SR_Records?=")
>> [('Inteum C/SR User Tip:  Quick Access to Recently Opened Inteum C/SR
>> Records', 'us-ascii')]
> 
> It is interesting that decode_header does what I would consider to be
> the right thing (from a pragmatic standpoint) with that particular bit
> of Microsoft not-quite-standards-compliant brain-damage; but, removing
> the tab is not in fact standards compliant if I'm reading the RFC
> correctly.
> 
You'd need to quote me chapter and verse on that. I understood that the
tab simply indicated continuation, but it's a *long* time since I read
the RFCs.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list