[英]Javascript String Output - Something to do with its type
I have a variable - I know its a special byte array or something similar - i might be wrong.我有一个变量——我知道它是一个特殊的字节数组或类似的东西——我可能错了。
The question is I am expecting to print this on console问题是我希望在控制台上打印这个
\xddSM\x8f\xda0\x10\xfd+\xab\xd9kH\xe2\xb0\x85\x92S\x17zi\xb5\xaaV\xdam/\x15\x07\xe3\x0c\xc4\x95?\x90\xed\x04\xe8*\xff\xbdc\x03\xdbVZ\xb8\xf5R
but all i see is this但我看到的就是这个
�SM��0�+��kHⰅ�Szi��V�m/�ĕ?���*��c�VZ��R
I cant post the code for it - But I guess some of you might have already got the idea我不能发布它的代码 - 但我想你们中的一些人可能已经有了这个想法
You can use the escape function like this to print the string to the console or insert it into the HTML.您可以像这样使用转义 function 将字符串打印到控制台或将其插入 HTML。
var x = escape("\xddSM\x8f\xda0\x10\xfd+\xab\xd9kH\xe2\xb0\x85\x92S\x17zi\xb5\xaaV\xdam/\x15\x07\xe3\x0c\xc4\x95?\x90\xed\x04\xe8*\xff\xbdc\x03\xdbVZ\xb8\xf5R").replace(/(%)/g, "\\x").toLowerCase(); document.getElementById("target").innerHTML = x;
<div id="target"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.