fix in decode email header, used while receiving email - for decoding encoded headers

This commit is contained in:
Anand Doshi 2012-08-07 12:24:05 +05:30
parent 5dc68444b6
commit 6bd511346f

View file

@ -63,12 +63,10 @@ def decode_email_header(s):
# double quotes in header prohibit decoding of header
decoded_header_tuple = email.header.decode_header(s.replace('"', ''))
decoded_list = []
for header in decoded_header_tuple:
decoded_list.append(cstr(header[0], encoding = header[1] or 'utf-8'))
decoded_list = map(lambda h: unicode(h[0], encoding=h[1] or 'utf-8'), decoded_header_tuple)
return " ".join(decoded_list)
def extract_email_id(s):
"""
Extract email id from email header format