]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-37482: Fix email address name with encoded words and special chars (GH-14561)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 21 Aug 2019 23:21:48 +0000 (16:21 -0700)
committerGitHub <noreply@github.com>
Wed, 21 Aug 2019 23:21:48 +0000 (16:21 -0700)
commitc5bba853d5e7836f6d4340e18721d3fb3a6ee0f7
tree84861d265c6c190fad14edcbe20d98f236bc7bef
parentfb3d7423f7ee4f6413774567d04b2f98b254e5f7
bpo-37482: Fix email address name with encoded words and special chars (GH-14561)

Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" <foo@example.com>
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= <foo@example.com>

https://bugs.python.org/issue37482
(cherry picked from commit df0c21ff46c5c37b6913828ef8c7651f523432f8)

Co-authored-by: bsiem <52461103+bsiem@users.noreply.github.com>
Lib/email/_header_value_parser.py
Lib/test/test_email/test_headerregistry.py
Misc/NEWS.d/next/Library/2019-07-09-11-20-21.bpo-37482.auzvev.rst [new file with mode: 0644]