Repository navigation
Fix invalid XML for emoji and math symbols in DocBook export - #17765
Conversation
# Conflicts: # GitVersion.yml
PR Summary by QodoFix invalid XML for emoji and math symbols in DocBook exports
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can move or hide resolved findings to focus on what still needs action |
|
The code-point iteration looks correct and fixes the surrogate-pair issue. One suggestion: could we add an integration test that generates a complete DocBook 4 or 5.1 export containing supplementary Unicode characters and validates the resulting XML? The current tests only parse a standalone |
I added a new test that runs the full DocBook 5.1 pipeline and checks that the output is well-formed XML and characters are preserved correctly. Schema validation would require a new dependency and may reveal layout issues, so I'd suggest handling that in a separate issue if needed. |
Siedlerchr
left a comment
There was a problem hiding this comment.
Yes, schema validation can be done in a new issue
|
Successfully created backport PR for |
* main: (90 commits) Chore(deps): Bump jablib/src/main/resources/csl-styles from `3220666` to `af0aea3` (JabRef#17788) Chore(deps): Bump us.hebi.graalvm:jfx-static-libs from 27-2 to 27.0.1 in /versions (JabRef#17796) chore(deps): update dependency org.bouncycastle:bcprov-jdk18on to v1.87 (JabRef#17794) Chore(deps): Bump actions/setup-java from 6.1.0 to 6.2.0 in /.github/actions/setup-gradle (JabRef#17795) Chore(deps): Bump actions/setup-java from 6.1.0 to 6.2.0 (JabRef#17792) Chore(deps): Bump docker/login-action from 4.7.0 to 4.8.0 (JabRef#17791) Chore(deps): Bump peter-evans/create-pull-request from 8.1.1 to 8.1.3 (JabRef#17793) Chore(deps): Bump anthropics/claude-code-action from 1.0.264 to 1.0.271 (JabRef#17790) Chore(deps): Bump ruby/setup-ruby from 1.336.0 to 1.338.0 (JabRef#17789) New Crowdin updates (JabRef#17785) Add "No value" subgroup to automatic keyword groups (JabRef#17716) Fix invalid XML for emoji and math symbols in DocBook export (JabRef#17765) Fix RTF export when formatting ends a field (JabRef#17766) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin from 3.20.1 to 3.20.2 in /build-logic (JabRef#17770) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin from 3.20.1 to 3.20.2 (JabRef#17769) New Crowdin updates (JabRef#17768) Diagnose stalled GUI tests and align dependency versions (JabRef#17763) Keep entry table still while a search match is in view (JabRef#16905) Add BibSonomy as a web search fetcher (JabRef#17611) Chore(deps): Bump com.konghq:unirest-modules-gson from 4.11.3 to 4.11.4 in /versions (JabRef#17761) ...
Summary
When an entry contains emoji or some math symbols the DocBook exports created invalid XML, so XML parsers could not read the file.
The reason is that
XMLCharsread the text one UTF-16charat a time. These characters use twochars, so each half was written as a separate character reference. Now the formatter reads the text by Unicode code point, so each character becomes one valid reference. Other characters are escaped as before.Steps to test
How it is know:
How it was before:
Related issues and pull requests
Closes #17747
AI usage
I used Claude Code (model claude-opus-5-5) as an assistant. It helped me understand why surrogate pairs created invalid XML and suggested the code change. I reviewed and adjusted the code, wrote the steps to test, and ran the tests and the manual export myself.
Checklist
CHANGELOG.mddescribing the change from the user's point of view (if the change is visible to the user)