日期:2014-05-16 浏览次数:20338 次
function getBytes(chrList) { var bytes = []; for (var i = 0; i < chrList.length; i++) { c = ""; ch = chrList.charAt(i); execScript("c = Hex(Asc(ch))", "vbscript"); bytes.push(c); } return bytes; } var chrList = "abc汉字"; alert(getBytes(chrList)); //gbk: 汉 BABA, 字D7D6 var aa = chrList.charCodeAt(3).toString(16); alert(aa); //unicode: 6C49,5B57