stuart bishop muxphestuartbishopnet nando wrote gentlemen please consider following ipython session 98 emailmessage_from_filef 99 print msubject utf8bw291as5jb20uynjdienhcntdo28gzgugy3ldqwrpdg8gdgvyw6egbgvn utf8baxnsyconw6nvigvzcgvjw61mawnh gives raw subject header value course wanted header unicode 100 emailheader import decode_header 101 decode_headermsubject out101 ouicombr cartxc3xa3o de crxc3xa9dito terxc3xa1 legislaxc3xa7xc3xa3o especxc3xadfica utf8 102 print decode_headermsubject00 ouicombr cartão de crédito terá legislação específica questions 1 currently return decoded header often need access raw header also headers encoded works subject doesnt work replyto etc 2 would break many apps changed yes particularly apps need log report broken email headers decoded 21 would add function messagegetheadersubject 211 would like propose patch obvious implementation id love see things become unicode aware perhaps return object implementing __str__ __unicode__ decode casttounicode conversion would decode headers known encodings raise exception headers unknown encodings similarly setting headers using unicode strings would use known encodings perform reverse operation still access raw value want round trip stuart bishop httpwwwstuartbishopnet wed 06 aug 2008 095421 0700 emailsig give decoded header