Author yunlee
Recipients barry, r.david.murray, yunlee
Date 2019-07-09.21:20:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562707246.84.0.835768356919.issue37532@roundup.psfhosted.org>
In-reply-to
Content
email.header.make_header() doesn't work if any `ascii` code is out of range(128)

For example 

>>> header = "Your booking at Voyager Int'l Hostel,=?UTF-8?B?IFBhbmFtw6EgQ2l0eQ==?=,   Panamá- Casco Antiguo"

>>> decode_header(header)
[(b"Your booking at Voyager Int'l Hostel,", None), (b' Panam\xc3\xa1 City', 'utf-8'), (b',   Panam\xe1- Casco Antiguo', None)]

>>> make_header(decode_header(header))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/header.py", line 174, in make_header
    h.append(s, charset)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/header.py", line 295, in append
    s = s.decode(input_charset, errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 9: ordinal not in range(128)
History
Date User Action Args
2019-07-09 21:20:46yunleesetrecipients: + yunlee, barry, r.david.murray
2019-07-09 21:20:46yunleesetmessageid: <1562707246.84.0.835768356919.issue37532@roundup.psfhosted.org>
2019-07-09 21:20:46yunleelinkissue37532 messages
2019-07-09 21:20:46yunleecreate