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:

The Grimke Sisters and Sexism

The necessity of birth control

via Thing of Things April 22, 2024

Clarendon Postmortem

I posted a postmortem of a community I worked to help build, Clarendon, in Cambridge MA, over at Supernuclear.

via Home March 19, 2024

How web bloat impacts users with slow devices

In 2017, we looked at how web bloat affects users with slow connections. Even in the U.S., many users didn't have broadband speeds, making much of the web difficult to use. It's still the case that many users don't have broadband speeds, both …

via Posts on March 16, 2024

more     (via openring)