[issue37482] Email address display name fails with both encoded words and special chars

R. David Murray report at bugs.python.org
Wed Jul 10 13:57:37 EDT 2019


R. David Murray <rdmurray at bitdance.com> added the comment:

FYI, it would have been most helpful if you had posted your example in the issue text instead of as an attached file, as it explains the problem better than your text does :)

Here is a minimal reproducer:

>>> m = EmailMessage(policy=strict)
>>> m['From'] = '"Foo Bar, España" <foo at example.com>'
>>> bytes(m)
b'From: Foo Bar, =?utf-8?q?Espa=C3=B1a?= <foo at example.com>\n\n'

This serialization of the header is, as you say, invalid.  Either the comma should be encoded, or the "Foo Bar," should be in quotes.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37482>
_______________________________________


More information about the Python-bugs-list mailing list