java html entity escape

 

 

    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 &lt; &#60;
> Greater than sign &gt; &#62;
& And number &amp; &#38;
" quotation marks &quot; &#34;
' apostrophe & Apos; (IE does not support) &#39;

Some other commonly used character entities

show result description Entity name Entity Number
Minute &cent; &#162;
£ pound &pound; &#163;
¥ Japanese yen &yen; &#165;
§ Festival &sect; &#167;
© copyright &copy; &#169;
® Trademark &reg; &#174;
× Multiplication sign &times; &#215;
÷ Sign of division &divide; &#247;

Guess you like

Origin www.cnblogs.com/ooo0/p/11975100.html