Java escape HTML

后端 未结 6 1011
故里飘歌
故里飘歌 2020-12-03 06:34

currently I use org.apache.commons.lang.StringEscapeUtils escapeHtml() to escape unwanted HTML tags in my Strings but then I realized it escapes characters with

6条回答
  •  既然无缘
    2020-12-03 07:21

    This looks very good to me:

    org/apache/commons/lang3/StringEscapeUtils.html#escapeXml(java.lang.String)

    By asking XML, you will get XHTML, which is good HTML.

提交回复
热议问题