Skip to content

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

Merged
serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-c83013c9-3.14
Aug 31, 2026
Merged

[3.14] gh-99064: Ignore the encoding declaration when parsing decoded text (GH-156734)#156751
serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-c83013c9-3.14

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 enabled auto-merge (squash) August 31, 2026 21:53
@serhiy-storchaka
serhiy-storchaka merged commit 4e8bce4 into python:3.14 Aug 31, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant