How to unescape HTML character entities in Java?

前端 未结 11 1772
耶瑟儿~
耶瑟儿~ 2020-11-21 22:38

Basically I would like to decode a given Html document, and replace all special chars, such as \" \" -> \" \", \">\" -

11条回答
  •  梦毁少年i
    2020-11-21 23:23

    I have used the Apache Commons StringEscapeUtils.unescapeHtml4() for this:

    Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes. Supports HTML 4.0 entities.

提交回复
热议问题