js code is as follows
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
}
擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...
python3 Next:
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)