• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Decoding Internationalised Email Headers

    August 10th, 2010
    email, python  [html]
    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:

    EDT with updating double counts

    I recently got confused thinking about the following case: Calculator bet: I am offered the opportunity to bet on a mathematical statement X to which I initially assign 50% probability (perhaps X = 139926 is a quadratic residue modulo 314159). I have acce…

    via The sideways view October 12, 2021

    Meditations on newborns

    [Content: death.]I wrote most of this a couple of months ago when Nora was a newborn, but the first few months are not that conducive to finishing blog posts. New babies put you into a liminal period, both in your own experience and in how others treat yo…

    via The whole sky October 3, 2021

    The value of in-house expertise

    An alternate title for this post might be, "Twitter has a kernel team!?". At this point, I've heard that surprised exclamation enough that I've lost count of the number times that's been said to me (I'd guess that it's more tha…

    via Posts on Dan Luu September 29, 2021

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact