简体   繁体   English

Javascript 字符串 Output - 与它的类型有关

[英]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.

相关问题 简单的javascript:搜索字符串的url,做点什么 - simple javascript: search url for string, do something 如何使用JavaScript中的已保存字符串进行操作 - How to do something with a saved string in javascript 在检查某些东西是否是字符串时可以进行类型转换比较吗? - Is it ok to do a type-converting comparison when checking if something is a string? javascript如何验证用户的数字输入并输出其类型 - javascript how to validate a users numeric input and output its type 用JavaScript在:target上做一些事情 - Do something on :target with javascript Javascript输出json字符串怎么做.replace - Javascript output json string how to do .replace JavaScript在页面上运行,但最后删除了自己的DOM节点。 我该如何测试呢? - JavaScript ran on page, but at the end deleted its own DOM node. How do I test it did something? 如果它大于或等于javascript中的某物,则想更改某物的值 - Want to change the value of something if its greater than or equal to something in javascript 测试字符串中的某些内容,然后在Javascript中将其加粗 - Test for something in a string and then bolden it in Javascript 将字符串返回到“ number”类型的输出字段,以解决用户错误的javascript - Returning a string to an output field of type “number” for user error javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM