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, substack

Recent posts on blogs I like:

Borderlines aren’t unusually attractive

Slutstack recently wrote an article advising women to adopt some of the traits of the hot-but-crazy BPD girl in order to appeal to men.

via Thing of Things November 21, 2026

Nora's Game Flaws

Today I was sitting in the living room reading a book, and my little sister Nora was sitting on the floor playing with these little lego people, but they look more like people than most lego people. There kept being flaws in her game, but she wouldn't…

via Anna Wise's Blog Posts November 21, 2026

I did a meditation and it sort of changed my personality?!

a trip report

via benkuhn.net November 8, 2026

more     (via openring)