0
String htmlToXml = "<div>Lorem dorum 漢字  is &gt; <p>&eacute;</p></div>";
String xmlString = unescapeUnicodeHtml(htmlToXml);
assert "<div>Lorem dorum 漢字  is &gt; <p>é</p></div>".equals(xmlString);

Is there a library that I can use to implement unescapeUnicodeHtml? If not, what is the best way to implement it?

IcedDante
  • 6,145
  • 12
  • 57
  • 100
  • This one? https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/index.html?org/apache/commons/lang/StringEscapeUtils.html – André Schild May 26 '16 at 20:39
  • was there a particular method you had in mind? – IcedDante May 26 '16 at 20:44
  • FYI: I've been trying to use this library without success... the problem is trying to retain the > and unescape the é (as the latter breaks the XML parser I'm using – IcedDante May 26 '16 at 20:45
  • The library does it correctly, I think your usecase isn't correct. > unescaped is realy > . In your case I would first replace all > < with something else (say |gt; for example) unescape it and then replace the |gt; back with > – André Schild May 26 '16 at 20:50

0 Answers0