Decoding Internationalised Email Headers

August 10th, 2010
email, python
Every so often someone will email me something where the subject has unicode in it. My naive tools don't know what to do with it, and I see stuff like:
=?UTF-8?Q?[Sociological_Images]_New_Comment_On:_Satter=E2=80=99s_Hierarch?=  =?UTF-8?Q?y_of_Food_Needs?=
It turns out python has a module for this, providing email.header.decode_header. This gives me:
[Sociological_Images] New Comment On: Satter's Hierarchy of Food Needs
So much nicer.

I am continually happily surprised at the fraction of the time that what I want is already implemented in the python standard library.

Comment via: facebook

Recent posts on blogs I like:

Starting With Chords

A lot of people play fiddle. Basically nobody starts by learning chords before learning melodies. But that's actually how I learned. I started with chords. One of the nice things about learning to play violin this way is that you can go busking even…

via Anna Wise's Blog Posts November 15, 2024

Stuffies

I have some stuffies and I just have a bunny. Bunny is a rabbit. Woof is a seal. My favorite stuffie is bun bun. I play with my stuffies. Sometimes I jump up with them and I roll them. I can just throw them in the air when I want to play bthululubp wi…

via Nora Wise's Blog Posts November 15, 2024

You Can Buy A Malaria Net

2024 election takes

via Thing of Things November 6, 2024

more     (via openring)