Similar to escape (), which is represented by a set of numbers XXX later is the hexadecimal number encoded in the character set table, that is, % XXXX and/uxxxx indicate the same, for example, if the hexadecimal 5ba0 value is input, it can be expressed by/u5ba0 or % u5ba0, and the number is 23456 in decimal format, the conversion using Unicode rules is "Pet" Chinese characters. That is, the results are different based on different rules, which is also given by the rule creator.
Another example is that 155 is converted from octal to decimal to 1*64 + 5*8 + 5 = 109.
String. fromcharcode (109) === "M"
There are a total of 256 octal or hexadecimal escape characters.
The fixed format of hexadecimal escape characters is (2 digits ):
\ X hexdigit
The conversion functions are provided below.
VaR chineseascode = {on: function (STR) {var arr = []; var hex; For (VAR I = 0; I <Str. length; I ++) {hex = ("00" + Str. charcodeat (I ). tostring (16 )). slice (-4); arr. push (HEX);} return "\ U" + arr. join ("\ U") ;}, UN: function (STR) {return Unescape (Str. replace (// \/g, "% "));}};
Reference JavaScript octal Escape Character http://cmc3.cn/n/258.html