How to unescape HTML character entities in Java?

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

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

11条回答
  •  悲哀的现实
    2020-11-21 23:19

    Spring Framework HtmlUtils

    If you're using Spring framework already, use the following method:

    import static org.springframework.web.util.HtmlUtils.htmlUnescape;
    
    ...
    
    String result = htmlUnescape(source);
    
    

提交回复
热议问题