escapeXml function is converting ѭ Ѯ to ѭ Ѯ which I guess it should not. What I read is that it Supports only the five basic XML entities (gt, lt, quot, amp, apos).
Is there a function that only converts these five basic xml entities.
escapeXml function is converting ѭ Ѯ to ѭ Ѯ which I guess it should not. What I read is that it Supports only the five basic XML entities (gt, lt, quot, amp, apos).
Is there a function that only converts these five basic xml entities.
The javadoc of
StringEscapeUtils.escapeXml
says that we have to useBut instead of
UnicodeEscaper
,NumericEntityEscaper
has to be used.UnicodeEscaper
will change everything to\u1234
symbols, butNumericEntityEscaper
escapes as{
, that was expected.In times of XML documents in UTF-8 having readable characters is sometimes preferred. This should work and recomposition of the
String
only happens once.The javadoc for the 3.1 version of the library says:
So you probably use an older version of the library. Update your dependencies (or reimplement the escape yourself: it's not rocket science)