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?=" >>> <2070776...@qq.com>\n\ntest body', policy=email.policy.default) >>> print(msg) To: "=?gb18030?B?bWFpbGZvcnRlc3R0?=" <2070776...@qq.com> test body >>> msg['To'] 'mailfortestt <2070776...@qq.com>' >>> msg['To'].defects (InvalidHeaderDefect('encoded word inside quoted string',),) ---------- resolution: -> out of date stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28122> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com