Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG export generates invalid XML, when escaping emojis #222

Open
YorikHansen opened this issue Jan 6, 2025 · 1 comment
Open

SVG export generates invalid XML, when escaping emojis #222

YorikHansen opened this issue Jan 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@YorikHansen
Copy link

When exporting a rendered graph to svg, emojis are not escaped to their codepoints. Instead the SVG contains the escaped bytes (which results in invalid XML).

Example:
πŸ‘©πŸΎβ€πŸ’» (Woman Technologist: Medium-Dark Skin Tone) gets escaped to ����‍�� but it should either stay πŸ‘©πŸΎβ€πŸ’» or get escaped to it's codepoints 👩🏾‍💻 (Woman + Medium-Dark Skin Tone + Zero Width Joiner + Laptop).

KGT-file (added .txt suffix to please github): example-issue-222.kgt.txt
SVG-file: example-issue-222.svg

@NiklasRentzCAU
Copy link
Member

For a little context: This issue occurs in the FreeHEP SVG exporter and is caused by the text normalization found in the XMLWriter class. This code has not been maintained in years, though.
A workaround could be implemented in the SemanticsSVGGraphics2D class in the writeString method, also taken from FreeHEP. Feel free to suggest improvements. Currently, the method is given the String
ߑ©ߏ¾‍ߒ»
for that emoji and the 7 bytes seem to come from that.
For comparison: The new SVG export by using klighd-vscode correctly renders the emoji in the SVG, albeit a little squished because AWT does not correctly estimate the size of the emoji.

@NiklasRentzCAU NiklasRentzCAU added the bug Something isn't working label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants