[Baypiggies] charsets in email headers

Jason Culverhouse jason at mischievous.org
Mon Aug 25 23:20:30 CEST 2008

Right here...

from email.header import decode_header

[('[Invitation] dummy event 4 @ Tue Aug 26 10pm \x96 11:',  


On Aug 25, 2008, at 1:46 PM, Brent Tubbs wrote:

> 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
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2425 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20080825/1f97e496/attachment.bin>

More information about the Baypiggies mailing list