public static void main(String[] args) {

        String str = " -<->-&-"-'";

        String unescapeHtml4 = StringEscapeUtils.unescapeHtml4(str);
        System.out.println(unescapeHtml4);
        String escapeHtml4 = StringEscapeUtils.escapeHtml4(unescapeHtml4);
        System.out.println(escapeHtml4);

        String unescapeHtml3 = StringEscapeUtils.unescapeHtml3(str);
        System.out.println(unescapeHtml3);
        String escapeHtml3 = StringEscapeUtils.escapeHtml3(unescapeHtml3);
        System.out.println(escapeHtml3);


    }

 

 

http://www.w3chtml.com/html/character.html

最常用的字符实体

显示结果 描述 实体名称 实体编号
  空格    
< 小于号 &lt; &#60;
> 大于号 &gt; &#62;
& 和号 &amp; &#38;
" 引号 &quot; &#34;
' 撇号 &apos; (IE不支持) &#39;

其他一些常用的字符实体

显示结果 描述 实体名称 实体编号
&cent; &#162;
£ &pound; &#163;
¥ 日圆 &yen; &#165;
§ &sect; &#167;
© 版权 &copy; &#169;
® 注册商标 &reg; &#174;
× 乘号 &times; &#215;
÷ 除号 &divide; &#247;

相关文章:

  • 2022-02-11
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-14
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2021-12-26
  • 2021-12-04
  • 2021-06-07
  • 2022-12-23
  • 2022-01-27
相关资源
相似解决方案