HTML character entity and escape string Encyclopedia __html

Source: Internet
Author: User
More comprehensive HTML entity escape character article: http://www.cnblogs.com/kiter/archive/2011/08/05/2128309.html
the composition of the escape string

The Escape string (Escape Sequence), that is, the character entity (Character Entity) is divided into three parts: the first part is a & symbol, English is called Ampersand; the second part is the entity (Entity) name or the # Plus entity (Entity) number; The third part is a semicolon.

For example, to display the less than sign (<), you can write &lt; or & #60;.

The advantage of using entity (Entity) name is better understanding, a see LT, probably guess is less than meaning, but its disadvantage is not all browsers support the newest Entity name. The entity (Entity) number can be processed by various browsers.

Tip: Entity names (Entity) are case-sensitive.

Note: The same symbol can be referenced in two ways, "entity name" and "entity number", the advantage of "entity name" is that it is easy to remember, but it is not guaranteed that all browsers can identify it successfully, and "entity number" has no such concern, but it is inconvenient to remember. JavaScript escape character

Escape sequence character
\b Backspace
\f Walk Paper Change page
\ n Line Wrap
\ r Enter
\ t Horizontal jumps (ctrl-i)
\' Single quotation mark
\" Double quotes
\\ Back slash

When programming to pay attention to the problem of special characters, many run-time problems are caused by the appearance of special characters.

Note that because the backslash itself is used as an escape character, you cannot type a backslash directly in the script. If you want to produce a backslash, you must type two backslashes (\ \) together.

Encoding Conversion (to Unicode)

(program code originates from network)

JS version

<script>
test = "Hello abc"
str = "for"
(i=0; i<test.length;    i++)
{  temp = test.charcodeat (i). toString ();  str + + "\\u" + New Array (5-string (temp). Length). Join ("0") +temp;
document.write (str)
</script>

HTML Special escape character list the most commonly used character entities Character entities

Show Description Entity name Entity number
Half a square big blank &ensp; & #8194;
The whole square big blank &emsp; & #8195;
Continuous line of blank spaces &nbsp; & #160;
< Less than &lt; & #60;
> Greater than &gt; & #62;
& & Symbols &amp; & #38;
" Double quotes &quot; & #34;
© Copyright &copy; & #169;
® Registered trademarks &reg; & #174;
Trademarks (USA) & #8482;
X Multiplication &times; & #215;
÷ Division &divide; & #247;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.