How to escape HTML special characters in Java?

后端 未结 5 1655
名媛妹妹
名媛妹妹 2021-01-01 21:01

Is there a way to convert a string to a string that will display properly in a web document? For example, changing the string

\"\"
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-01 21:40

    HTMLEntities is an Open Source Java class that contains a collection of static methods (htmlentities, unhtmlentities, ...) to convert special and extended characters into HTML entitities and vice versa.

    http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=htmlentities

提交回复
热议问题