Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue47244

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:email.utils.formataddr does not respect double spaces
Type:behaviorStage:
Components:emailVersions:Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7
process
Status:openResolution:
Dependencies:Superseder:
Assigned To:Nosy List: AlecRosenbaum, barry, r.david.murray
Priority:normalKeywords:

Created on2022-04-06 17:45 byAlecRosenbaum, last changed2022-04-11 14:59 byadmin.

Messages (1)
msg416891 -(view)Author: Alec Rosenbaum (AlecRosenbaum)Date: 2022-04-06 17:45
It seems that `email.utils.formataddr` and `email.utils.parseaddr` are not directly inverse from each other, because `formataddr` does not respect double spaces within the "realname" section.For example:```from email.utils import formataddr, parseaddridentity = '"foo  bar" <foo@example.com>'print(formataddr(parseaddr(identity)))# 'foo  bar <foo@example.com>'print(formataddr(parseaddr(formataddr(parseaddr(identity)))))# 'foo bar <foo@example.com>'```The first round trip strips the quotes, and the second round trip strips the double space in the "realname" section.The utility function only seems to check for special characters, but it should also check for double spaces.
History
DateUserActionArgs
2022-04-11 14:59:58adminsetgithub: 91400
2022-04-06 17:45:12AlecRosenbaumcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp