Java escape HTML

后端 未结 6 1021
故里飘歌
故里飘歌 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:18

    StringUtils.replaceEach(str, new String[]{"&", "\"", "<", ">"}, new String[]{"&", """, "<", ">"})
    

提交回复
热议问题