我正在创建一些随机字符串,使用%作为符号和一些URI组件(例如。%27),但我无法添加后面带有字符的%。例如。%27。我使用decodeURIComponent()是因为像‘(%27),“(%22)这样的字符。
//'Hello'
decodeURIComponent('%27Hello%27');
//No Output
decodeURIComponent('%Hello%');关于如何在字符串中包含%并使用decodeURIComponent的任何想法。
发布于 2015-05-20 20:38:51
decodeURIComponent的目的是解码encodeURIComponent的输出,这永远不会产生'%Hello%'。您可能根本不需要调用decodeURIComponent。
https://stackoverflow.com/questions/30349815
复制相似问题