Search code examples
javaxmlencodingdecoding

How to convert "ConvertText" to ConvertText in Java?


I want to convert "ConvertText" to "ConvertText". Its XML encoded. Which Java class should I use for this?

We have a requirement to convert the password from plain text to XML encoded.


Solution

  • Apache Commons Text's StringEscapeUtils should do the trick:

    String result = 
        StringEscapeUtils.unescapeHtml4
        ("ConvertText");