JS-unicode编码转换
<script type="text/Javascript">
var toUN = {
on: function(str) {
var a = [],
i = 0;
for (; i < str.length;) a[i] = ("00" + str.charCodeAt(i++).toString(16)).slice( - 4);
return "\\u" + a.join("\\u")
},
un: function(str) {
return unescape(str.replace(/\\/g, "%"))
}
};
alert(toUN.on("\"请输\""));
alert(toUN.un("\\u0022\\u8BF7\\u8F93\\u0022"));
</script>