js代码如下var e = a.charCodeAt(t).toString(16);这一行不明白function encode_unicode_param(a) { for (var s = "", t = 0; t < a.length; t++) { var e = a.charCodeAt(t).toString(16); s += 2 == e.length ? "n" + e: e } return s}
1 回答
jeck猫
TA贡献1909条经验 获得超7个赞
python3 下:
def encode_unicode_param(s):
results = []
for char in s:
h = hex(ord(char))[2:]
format_string = 'n{}' if len(h) == 2 else '{}'
results.append(format_string.format(h))
return ''.join(results)
添加回答
举报
0/150
提交
取消