16制编码如何转换为字符串

时间:2023-01-10 20:26:10
在别人javascript程序中看到如下数组,可否看出数组元素对应字符串呀。
var _0xbb11=["","\x43\x6C\x75\x62","\x44\x69\x61\x6D\x6F\x6E\x64","\x48\x65\x61\x72\x74","\x53\x70\x61\x64\x65","\x3C\x66\x6F\x6E\x74\x20\x63\x6F\x6C\x6F\x72\x3D\x27\x30\x30\x30\x30\x30\x30\x27\x3E\x3C\x74\x74\x3E\x26\x63\x6C\x75\x62\x73\x3B\x3C\x2F\x74\x74\x3E\x3C\x2F\x66\x6F\x6E\x74\x3E","\x3C\x66\x6F\x6E\x74\x20\x63\x6F\x6C\x6F\x72\x3D\x27\x43\x42\x30\x30\x30\x30\x27\x3E\x3C\x74\x74\x3E\x26\x64\x69\x61\x6D\x73\x3B\x3C\x2F\x74\x74\x3E\x3C\x2F\x66\x6F\x6E\x74\x3E","\x3C\x66\x6F\x6E\x74\x20\x63\x6F\x6C\x6F\x72\x3D\x27\x43\x42\x30\x30\x30\x30\x27\x3E\x3C\x74\x74\x3E\x26\x68\x65\x61\x72\x74\x73\x3B\x3C\x2F\x74\x74\x3E\x3C\x2F\x66\x6F\x6E\x74\x3E"]

2 个解决方案

#1


把所有 "\x" 替换为 "%" 使用unescape函数解

#2


var _0xbb11=["","Club","Diamond","Heart","Spade","<font color='000000'><tt>&clubs;</tt></font>","<font color='CB0000'><tt>&diams;</tt></font>","<font color='CB0000'><tt>&hearts;</tt></font>"]

顺便翻译了一下

#1


把所有 "\x" 替换为 "%" 使用unescape函数解

#2


var _0xbb11=["","Club","Diamond","Heart","Spade","<font color='000000'><tt>&clubs;</tt></font>","<font color='CB0000'><tt>&diams;</tt></font>","<font color='CB0000'><tt>&hearts;</tt></font>"]

顺便翻译了一下