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

Is there any UTF-16 support (Emojis, Emoticons) in Yanel? #94

Open
baszero opened this issue Dec 22, 2021 · 1 comment
Open

Is there any UTF-16 support (Emojis, Emoticons) in Yanel? #94

baszero opened this issue Dec 22, 2021 · 1 comment

Comments

@baszero
Copy link
Contributor

baszero commented Dec 22, 2021

The current Yanel / Yarep only supports UTF-8 encoded XMLs (<?xml version="1.0" encoding="UTF-8"?>).
So while you technical "can" save emojis in such an XML, the Xerces Parser (2.11) will fail, because Emoticons are not allowed in UTF-8 XMLs.

So is there any solution how to use UTF-16 XMLs with Yanel?

A workaround would be to violate the rules and store Emojis in the current UTF-8 XMLs and avoid using Xerces (which means in the Yanel-Apps: never use the BasicXMLResource.java:getTransformedInputStream() method). Instead, the resource could read the XML via JAXB into a Java Bean and then pass the content from that to XSLT, like:

MyJAXB bean = XMLBindingHelper.read(...);
xslDocument.getRootDocument().append(....params from bean....);

But I don't like the approach that you have to hardcode every property that you want to pass up to XSL. It should be something that also passes up ALL the elements in the XML, so also a 1:1 approach like the Xerces one...

Any ideas?

@baszero
Copy link
Contributor Author

baszero commented Dec 22, 2021

Another workaround: you simply remove all Emojis in your application by filtering all input texts that can be submitted by users. For this I can recommend this library: https://github.com/vdurmont/emoji-java , you just use EmojiParser.removeAllEmojis(string). In my case this works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant