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

Tim Golden mail at timgolden.me.uk
Wed Feb 25 12:27:07 EST 2009


Thorsten Kampe wrote:
> * Gabriel Genellina (Wed, 25 Feb 2009 14:00:16 -0200)
>> En Wed, 25 Feb 2009 13:40:31 -0200, Thorsten Kampe  
>> <thorsten at thorstenkampe.de> escribió:
>>> * Roy H. Han (Wed, 25 Feb 2009 10:17:22 -0500)
>>>> Thanks, RDM, for stating the right approach.
>>>> Thanks, Steve, for teaching by example.
>>>>
>>>> I wonder why the email.message_from_string() method doesn't call
>>>> email.header.decode_header() automatically.
>>> And I wonder why you would think the header contains Unicode characters
>>> when it says "us-ascii" ("=?us-ascii?Q?"). I think there is a tendency
>>> to label everything "Unicode" someone does not understand.
>> And I wonder why you would think the header does *not* contain Unicode  
>> characters when it says "us-ascii"?.
> 
> Basically because it didn't contain any Unicode characters (anything 
> outside the ASCII range).

And I imagine that Gabriel's point was -- and my point certainly
is -- that Unicode includes all the characters *inside* the
ASCII range.


TJG



More information about the Python-list mailing list