Repository navigation
fix: preserve XML input lengths and parse declaration attributes - #1039
Merged
Merged
Conversation
andiwand
force-pushed
the
review/20-table-spans
branch
from
October 5, 2026 06:12
35d7498 to
52fc542
Compare
…stream load_buffer with encoding_auto reads a latin1 declaration. The flat ODF passes TextFile::text(), which is already UTF-8 but keeps its declaration, so a latin1 document decoded its text twice and read "ä" as "ä". The string overload now states encoding_utf8, as load_string did, and keeps the explicit length. The stream overload reads raw bytes, so it keeps the detection. Tests cover the string overload, a latin1 flat ODF document, and whitespace before the `=` of a declaration attribute. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gb1fLafqqzehpqPuU6uBfn
andiwand
force-pushed
the
review/21-xml-input
branch
from
October 5, 2026 06:46
058564a to
8421f8e
Compare
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.
🤖 Generated with Claude Code
XML string parsing passes the buffer length to pugixml and stays UTF-8. Stream parsing uses the shared checked reader and detects UTF-16/32 without cutting at a zero byte, and file parsing rejects lengths that cannot fit the stream API.
Encoding detection reads declaration attributes rather than searching arbitrary text, so stylesheet instructions and attribute values cannot select the document encoding. Remove an unused parser wrapper and use size_t for text-token offsets.
Validation: 144 XML, flat ODF, and OOXML tests pass, including UTF-16 buffer/stream parsing, failed input streams, and misleading encoding text.