[issue28122] email.header.decode_header can not decode string with quotation

R. David Murray report at bugs.python.org
Tue Sep 13 14:42:23 EDT 2016


R. David Murray added the comment:

Note, however, that python3 will compensate for this bug in the input, and register a defect for it:

>>> import email
>>> import email.policy
>>> msg = email.message_from_string('To: "=?gb18030?B?bWFpbGZvcnRlc3R0?=" <2070776562 at qq.com>\n\ntest body', policy=email.policy.default)
>>> print(msg)
To: "=?gb18030?B?bWFpbGZvcnRlc3R0?=" <2070776562 at qq.com>

test body
>>> msg['To']
'mailfortestt <2070776562 at qq.com>'
>>> msg['To'].defects
(InvalidHeaderDefect('encoded word inside quoted string',),)

----------
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28122>
_______________________________________


More information about the Python-bugs-list mailing list