directory structure:
- Character sets supported by JavaScript and HTML
- How JavaScript and HTML behave as Unicode character sets
- Reference articles
Character sets supported by JavaScript and HTML
JavaScript is Unicode-enabled.
Modern browsers support ASCII character sets, ISO character sets, mathematical symbols, Greek letters, and other symbols in Web pages. HTML5 uses UTF-8 by default. Readers can click here to see the relationship between ASCII, Unicode, and Utf-8.
How JavaScript and HTML behave as Unicode character sets
The HTML page uses the Web document object, which behaves as a Unicode character set by escaping the string, with the following syntax: "The first part is a & symbol, English is called Ampersand; the second part is the entity name or the # plus entity number The third part is a semicolon. "For example: Character &" can be represented in HTML as "&", "& #38;" or "& #x0026;" Click here to view details.
JavaScript uses the browser system object, which is hexadecimal. Unlike HTML, which behaves like a Unicode character set, he has its own escape character,theJavaScript escape character:
Unicode Character Value |
Escape Sequences |
meaning |
category |
\u0008 |
\b |
Backspace |
|
\u0009 |
\ t |
Tab |
Blank |
\u000a |
\ n |
newline character (line feed) |
Line Terminator |
\u000b |
\v |
Vertical tab |
Blank |
\u000c |
\f |
Page change |
Blank |
\u000d |
\ r |
Enter |
Line Terminator |
\u0020 |
|
Space |
Blank |
\u0022 |
\" |
Double quotation marks (") |
|
\u0027 |
\‘ |
Single quotation mark (') |
|
\u005c |
\\ |
Back slash (\) |
|
\u00a0 |
|
Non-breaking spaces |
Blank |
\u2028 |
|
Row delimiter |
Line Terminator |
\u2029 |
|
Paragraph separator |
Line Terminator |
\ufeff |
|
BYTE order mark |
Blank |
The reader can open the computer's own character mapping table, where you can find Unicode code, such as:
The Unicode in the line of the Arial column goes to the input string "fe6a", it automatically jumps to the percent semicolon, and displays "u+fe6a" at the bottom.
The reader can write the following test code in HTML:
<! DOCTYPE html>
<title>test.html</title>
<meta name= "Content-type" content= "text/html; Charset=utf-8 ">
<body>
<script>
document.write ("\ufe6a& #65130;");
Alert ("\ufe6a");
</script>
<p>\ufe6a
<p>& #65130;
</body>
Readers can see the following effect on the browser:
"\ufe6a" and "& #65130 in document documents;" are normally displayed, readers need to note that the former is JavaScript, so it will be converted by JavaScript, which is the escape character in HTML, so it will be sent to the HTML document intact, and converted by HTML. There is an alert warning box in the above code that supports the Unicode character set, and if you write an escape string of HTML in it, the escaped string will not be converted because the content of alert is not sent to the HTML document object.
Describes the difference between JavaScript and HTML performance Unicode, which can be converted using an online Unicode encoding if the Unicode code for a symbol or the HTML escape string code next to each other in the character map or character set is too cumbersome. When using the online Unicode encoding conversion, ASCII character representable Unicode characters are the default HTML escaped string form, which also means that the HTML escape string is also part of the Unicode encoding, when the reader can go through the "Chinese to Unicode" to implement hexadecimal.
Reference articles
Http://baike.baidu.com/link?url=kf0Em5vWVn7-WJMda7lfnqrsYR9B0b2ermZ3BMNr369WVAlCzi57oX3ZjxZPe3e-_ bzbo4rnsgx7-m9aqmcd3yijc2lgwttpcubnjporsmu8s2wxabegh1oailu-jt13
http://www.codeweblog.com/javascript%E4%B8%AD%E7%9A%84alert-%E5%87%BD%E6%95%B0%E4%BD%BF%E7%94%A8%E6%8A%80%E5% b7%a7%e8%af%a6%e8%a7%a3/
Http://www.runoob.com/charsets/ref-html-utf8.html
This is the original works of Bo Master, if you need to reprint please indicate the source
"JavaScript" analysis of the relationship between JavaScript and HTML and the Unicode character set