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
The most common character entity
show result | description | Entity name | Entity Number |
---|---|---|---|
Blank | |   | |
< | Less than sign | < | < |
> | Greater than sign | > | > |
& | And number | & | & |
" | quotation marks | " | " |
' | apostrophe | & Apos; (IE does not support) | ' |
Some other commonly used character entities
show result | description | Entity name | Entity Number |
---|---|---|---|
¢ | Minute | ¢ | ¢ |
£ | pound | £ | £ |
¥ | Japanese yen | ¥ | ¥ |
§ | Festival | § | § |
© | copyright | © | © |
® | Trademark | ® | ® |
× | Multiplication sign | × | × |
÷ | Sign of division | ÷ | ÷ |