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:

Animal Welfare and Capabilitarianism

All ethics is a special case of animal welfare science

via Thing of Things December 18, 2024

Developing the middle ground on polarized topics

Avoiding false dichotomies The post Developing the middle ground on polarized topics appeared first on Otherwise.

via Otherwise November 25, 2024

How to eat vegan on Icon of the Seas

Royal Caribbean has a new giant cruise ship, Icon of the Seas, which has a large selection of food options.

via Home November 21, 2024

more     (via openring)