fix junitxml bin_xml_escape: supplementary plane characters incorrectly escaped#14484
Open
EternalRights wants to merge 3 commits into
Open
fix junitxml bin_xml_escape: supplementary plane characters incorrectly escaped#14484EternalRights wants to merge 3 commits into
EternalRights wants to merge 3 commits into
Conversation
for more information, see https://pre-commit.ci
| def test_bin_xml_escape_supplementary_plane() -> None: | ||
| assert bin_xml_escape(chr(0x1F600)) == chr(0x1F600) | ||
| assert bin_xml_escape("test_😀") == "test_😀" | ||
| assert bin_xml_escape("test_𠀀") == "test_𠀀" |
Member
There was a problem hiding this comment.
What kinda whitespace is this
We may need to rename the function as we ought to avoid leaving likeness as is
Contributor
Author
There was a problem hiding this comment.
Good point, I'll fold the supplementary plane checks into the existing test and drop the separate function. Pushing a fix shortly.
…, drop separate function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
illegal_xml_reregex inbin_xml_escapewas using\u10000-\u10ffffto cover the supplementary plane range, but Python's\uescape only takes 4 hex digits. So\u10000was parsed as\u1000+0and\u10ffffas\u10ff+ff, meaning the entire supplementary plane (U+10000 to U+10FFFF) was missing from the "valid" character set.This caused all supplementary plane characters to be incorrectly escaped in JUnit XML output -- emoji, CJK Extension B-F, mathematical symbols, etc. For example
bin_xml_escape("test_😀")returned"test_#x1F600"instead of"test_😀".The fix: change
\u10000-\u10ffffto\U00010000-\U0010ffff(8-digit unicode escape).Also uncommented the supplementary plane code points in the existing
test_bin_xml_escapetest, and added a dedicatedtest_bin_xml_escape_supplementary_planetest with emoji, CJK Ext B, and musical symbol cases.Closes #14483