homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author AlecRosenbaum
Recipients AlecRosenbaum, barry, r.david.murray
Date 2022年04月06日.17:45:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1649267112.95.0.680497304101.issue47244@roundup.psfhosted.org>
In-reply-to
Content
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, parseaddr
identity = '"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
Date User Action Args
2022年04月06日 17:45:12AlecRosenbaumsetrecipients: + AlecRosenbaum, barry, r.david.murray
2022年04月06日 17:45:12AlecRosenbaumsetmessageid: <1649267112.95.0.680497304101.issue47244@roundup.psfhosted.org>
2022年04月06日 17:45:12AlecRosenbaumlinkissue47244 messages
2022年04月06日 17:45:12AlecRosenbaumcreate

AltStyle によって変換されたページ (->オリジナル) /