如何检测字符串是否使用escape()或encodeURIComponent()进行编码) [英] How to detect if a string is encoded with escape() or encodeURIComponent()
问题描述
鼓励您的客户端使用encodeURIComponent()。请参阅此页面以获取解释:比较escape(),encodeURI()和encodeURIComponent()一>。如果你真的想要弄清楚一些东西是如何被编码的,你可以尝试寻找一些转义()和encodeURI()不被编码的字符。
I have a web service that receives data from various clients. Some of them sends the data encoded using escape(), while the others instead use encodeURIComponent(). Is there a way to detect the encoding used to escape the data?
Encourage your clients to use encodeURIComponent(). See this page for an explanation: Comparing escape(), encodeURI(), and encodeURIComponent(). If you really want to try to figure out exactly how something was encoded, you can try to look for some of the characters that escape() and encodeURI() do not encode.
这篇关于如何检测字符串是否使用escape()或encodeURIComponent()进行编码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!