function to16on(str){
var a = [],i = 0;
for (;
i < str.length ;
) a[i] = ("00" + str.charCodeAt(i ++).toString(16)).slice(-4);
return "\\u" + a.join("\\u");
}
function to16un(str) {
return unescape(str.replace(/\\/g, "%"));
}
function tohtmlon(str){
var a = [], i = 0;
for (;
i < str.length ;
) a[i] = str.charCodeAt(i ++);
return "&#" + a.join(";&#") + ";";
}
function tohtmlun(str){
return str.replace(/&#(x)?([^&]{1,5});?/g, function (a, b, c) {
return String.fromCharCode(parseInt(c,b?16:10));
});
}