Skip to content

[3.15] gh-99064: Ignore the encoding declaration when parsing decoded text (GH-156734) - #156750

Merged
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-c83013c9-3.15
Oct 9, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-c83013c9-3.15

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

ElementTree.parse() with a text file mis-decoded the text in the C
implementation: _parse_whole() encoded it as UTF-8, but left expat to honor
the encoding declared in the document. It now overrides the encoding, as
XMLParser.feed() already does for str data.
(cherry picked from commit c83013c)

…text (pythonGH-156734)

ElementTree.parse() with a text file mis-decoded the text in the C
implementation: _parse_whole() encoded it as UTF-8, but left expat to honor
the encoding declared in the document.  It now overrides the encoding, as
XMLParser.feed() already does for str data.
(cherry picked from commit c83013c)
@serhiy-storchaka
serhiy-storchaka merged commit 808aadf into python:3.15 Oct 9, 2026
56 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the backport-c83013c9-3.15 branch October 9, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant