Skip to content

gh-62259: Add support of multi-byte encodings in the XML parser#149860

Open
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:pyexpat-multibyte-encodings2
Open

gh-62259: Add support of multi-byte encodings in the XML parser#149860
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:pyexpat-multibyte-encodings2

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
Member

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

Supported encodings: "cp932", "cp949", "cp950", "Big5","EUC-JP", "GB2312", "GBK", "johab", and "Shift_JIS".

Partially supported encodings (only BMP characters): "Big5-HKSCS", "EUC_JIS-2004", "EUC_JISX0213", "Shift_JIS-2004", "Shift_JISX0213", "utf-8-sig" and non-standard aliases like "UTF8" (without hyphen).

The parser now raises ValueError for known unsupported multi-byte encodings such us "ISO-2022-JP" or "raw-unicode-escape" instead of failing later, when encounter non-ASCII data.

Supported encodings: "cp932", "cp949", "cp950", "Big5","EUC-JP",
"GB2312", "GBK", "johab", and "Shift_JIS".

Partially supported encodings (only BMP characters): "Big5-HKSCS",
"EUC_JIS-2004", "EUC_JISX0213", "Shift_JIS-2004", "Shift_JISX0213",
"utf-8-sig" and non-standard aliases like "UTF8" (without hyphen).

The parser now raises ValueError for known unsupported
multi-byte encodings such us "ISO-2022-JP" or "raw-unicode-escape"
instead of failing later, when encounter non-ASCII data.
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 15, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32704028 | 📁 Comparing 25c8b75 against main (7e98deb)

  🔍 Preview build  

3 files changed
± library/pyexpat.html
± whatsnew/3.16.html
± whatsnew/changelog.html

Copy link
Copy Markdown
Member

@malemburg malemburg left a comment

Choose a reason for hiding this comment

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

LGTM.

The only detail that is missing is the documentation update. This still reads "UTF-8, UTF-16, ISO-8859-1 (Latin1), and ASCII" which already appears to be out of date.

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