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
最常用的字符实体
| 显示结果 | 描述 | 实体名称 | 实体编号 |
| |
空格 |
|
  |
| < |
小于号 |
< |
< |
| > |
大于号 |
> |
> |
| & |
和号 |
& |
& |
| " |
引号 |
" |
" |
| ' |
撇号 |
' (IE不支持) |
' |
其他一些常用的字符实体
| 显示结果 | 描述 | 实体名称 | 实体编号 |
| ¢ |
分 |
¢ |
¢ |
| £ |
镑 |
£ |
£ |
| ¥ |
日圆 |
¥ |
¥ |
| § |
节 |
§ |
§ |
| © |
版权 |
© |
© |
| ® |
注册商标 |
® |
® |
| × |
乘号 |
× |
× |
| ÷ |
除号 |
÷ |
÷ |