Fix leading digit in AlwaysOnBase64NameProcessor encoded names - #895
Merged
cowtowncoder merged 6 commits intoAug 22, 2026
Conversation
AlwaysOnBase64NameProcessor encoded names
Javadoc still claimed no prefix is ever added, which no longer holds for names encoding to a leading digit (U+0400 and above). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…se64 tests Existing test only checked that no element name starts with a digit, which would still pass if the marker scheme changed. Assert the exact encoded names, add the U+03FF/U+0400 boundary where the marker starts being needed, and cover attribute names (same NameStartChar rule, same call site). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
AlwaysOnBase64NameProcessor can emit names that start with a digit
base64url's alphabet includes digits, so any name whose first character is U+0400 or above (Cyrillic, Arabic, CJK, emoji, and so on) encodes to a leading digit, which is not a valid XML name start; Woodstox does not validate names, so the write succeeds but the output no longer parses back, which loses the round trip this always-on processor is meant to provide. I restore a valid start character by prepending a single
_when the encoding begins with one that can't start a name, and strip it back off on decode; a base64url encoding of UTF-8 bytes never begins with_on its own, so the marker stays unambiguous, the mapping stays one-to-one, and letter-leading names go out exactly as before.