Skip to content

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

Merged
serhiy-storchaka merged 1 commit into
python:3.13from
serhiy-storchaka:backport-c83013c9-3.13
Sep 1, 2026
Merged

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

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 16f4dee into python:3.13 Sep 1, 2026
78 of 80 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