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 < 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 |
  |
& #8194; |
|
The whole square big blank |
  |
& #8195; |
|
Continuous line of blank spaces |
|
& #160; |
< |
Less than |
< |
& #60; |
> |
Greater than |
> |
& #62; |
& |
& Symbols |
& |
& #38; |
" |
Double quotes |
" |
& #34; |
© |
Copyright |
© |
& #169; |
® |
Registered trademarks |
® |
& #174; |
™ |
Trademarks (USA) |
™ |
& #8482; |
X |
Multiplication |
× |
& #215; |
÷ |
Division |
÷ |
& #247; |