[Baypiggies] charsets in email headers

Brent Tubbs brent.tubbs at gmail.com
Mon Aug 25 22:46:42 CEST 2008


I'm writing a Google App Engine app that accepts incoming emails using
the free smtp2web.com service.  Things are generally working, but some
(not all) subject lines in the emails look like this (this one's a
Google Calendar event invitation):

=?windows-1252?Q?=5BInvitation=5D_dummy_event_4_=40_Tue_Aug_26_10pm_=96_11=3A?=
        =?windows-1252?Q?30pm_=28=22Schmobag=5FHogfather=22=29?=

I've learned that that's got something to do with the subject being in
the windows-1252 charset, but I'm mystified as to how to turn that
into human-readable ASCII.  The python email module has a charset
class that's supposed to help with this I think, but I don't know how
to make it do what I need.

Any suggestions on the best way to turn the ugly string above into
something nicer?

Thanks,
Brent


More information about the Baypiggies mailing list