0

I want to convert the string <p>&uuml;&egrave;</p> to <p>üé</p>, but both StringEscapeUtils.unescapeHtml4() (from org.apache.commons.text) and HtmlUtils.unescapeHtml() (from org.springframework.web.util) convert it to &lt;p&gt;üè&lt;/p&gt;. Is there a way to keep existing html tags intact?

Nickkk
  • 2,261
  • 1
  • 25
  • 34
  • 2
    `org.apache.commons.text.StringEscapeUtils.unescapeHtml4("

    üè

    ")` returned `

    üè

    ` for me.
    – Xavi López Jan 13 '20 at 12:22
  • Both work fine for me. The output you mention is escaped rather then unescaped. – Ivar Jan 13 '20 at 12:22
  • You're right, it works. The problem was that I put the result in a html document, which of course has to encode it again, so it looked like that function didn't work. – Nickkk Jan 13 '20 at 15:04

0 Answers0