I convert hex to string. I have hexstring: "0xe4b883e5bda9e7a59ee4bb99e9b1bc" and use this code:
hex_to_ascii(str1){
var hex = str1.toString().substring(2, str1.length);
var str = '';
for (var n = 0; n < hex.length; n += 2) {
str += String.fromCharCode(parseInt(hex.substr(n, 2), 16));
}
return str;
}
the correct response must be "七彩神仙鱼", but my response is "ä¸å½©ç¥ä»é±¼". What's wrong with my code. Please help me, thanks.