Skip to content

gh-53144: Improve charset support in the email package#149942

Open
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:email-charset-aliases
Open

gh-53144: Improve charset support in the email package#149942
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:email-charset-aliases

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka commented May 17, 2026

Defer to the codecs module for all aliases.
Use MIME/IANA names for all IANA registered charsets.

Defer to the codecs module for all aliases.
Use MIME/IANA names for all IANA registered charsets.
@serhiy-storchaka serhiy-storchaka requested a review from a team as a code owner May 17, 2026 09:42
@malemburg malemburg changed the title gh-53144: Imporove charset support in the email package gh-53144: Improve charset support in the email package May 17, 2026
Comment thread Lib/email/charset.py Outdated
'mac-roman': 'macintosh',

# latin-1 and iso-8859-1 are different codecs in Python.
'latin-1': 'iso-8859-1',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latin-1 codec is builtin, whereas the iso8859_1 one is generated from the Unicode mapping sets. They both implement the same codec, though, so the comment is misleading.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is why we need this mapping. Because codecs.lookup() returns different CodecInfo objects with different names. I think that it would be better to make latin1 a simple alias of iso-8859-1, but this is a different issue.

How would you write a comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants