New submission from Matthew <[email protected]>: The parser for passing an addr_spec to email.headerregistry.Address does not allow non-ASCII local parts, but the rest of the email package handles them fine, either straight (with explicit references to RFC6532 and SMTPUTF8), or encoding as expected. Apologies if I've misunderstood something.
>>> from email.message import EmailMessage >>> msg = EmailMessage() >>> msg['To'] = 'Matthéw <aé@example.com>' >>> msg.as_string() 'To: =?utf-8?q?Matth=C3=A9w?= <[email protected]>\n\n' >>> msg['To'].addresses[0] Address(display_name='Matthéw', username='aé', domain='example.com') >>> msg['To'].addresses[0].addr_spec 'aé@example.com' >>> email.headerregistry.Address(addr_spec=msg['To'].addresses[0].addr_spec) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/headerregistry.py", line 48, in __init__ raise a_s.all_defects[0] email.errors.NonASCIILocalPartDefect: local-part contains non-ASCII characters) >>> ---------- components: email messages: 342254 nosy: barry, dracos, r.david.murray priority: normal severity: normal status: open title: email.headerregistry.Address blocks Unicode local part addr_spec accepted elsewhere versions: Python 3.6 _______________________________________ Python tracker <[email protected]> <https://bugs.python.org/issue36893> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
