JavaScript:字符和unicode码转换
字符转unicode码:用charCodeAt();
'a1'.charCodeAt(1); //49 (0x31)
'a1'.charCodeAt(); //97 (0x61)
'中'.charCodeAt(); //20013
unicode码转字符:用fromCharCode();
String.fromCharCode(0x61,0x31,20013); //"a1中"
字符转unicode码:用charCodeAt();
'a1'.charCodeAt(1); //49 (0x31)
'a1'.charCodeAt(); //97 (0x61)
'中'.charCodeAt(); //20013
unicode码转字符:用fromCharCode();
String.fromCharCode(0x61,0x31,20013); //"a1中"