i have my function to convert string to hex:
function encode(str){
    str = encodeURIComponent(str).split('%').join('');
    return str.toLowerCase();
}
example:
守护村子
alert(encode('守护村子'));
the output would be:
e5ae88e68aa4e69d91e5ad90
It works on Chinese characters. But when i do it with English letters
alert(encode('Hello World'));
it outputs:
hello20world
I have tried this for converting string to hex:
function String2Hex(tmp) {
    var str = '';
    for(var i = 0; i < tmp.length; i++) {
        str += tmp[i].charCodeAt(0).toString(16);
    }
    return str;
}
then tried it on the Chinese characters above, but it outputs the UTF-8 HEX:
5b8862a467515b50
not the ANSI Hex:
e5ae88e68aa4e69d91e5ad90
I also have searched converting UFT8 to ANSI but no luck. Anyone could help me? Thanks!
 
     
     
     
     
     
     
     
     
    