5
在Python试图端口的代码片段:urllib.quote_plus(),相当于在JavaScript
my_input = "this&is£some text"
encoded_input = urllib.quote_plus(str(my_input))
...给JavaScript:
var my_input = "this&is£some text";
encoded_input = encodeURIComponent(my_input);
次要的不同之处在于urllib.quote_plus()
将空格转换到+
而不是%20
(link)。 只是想知道是否有人可以提供任何想法。 这个目前正...
var my_input = "this&is£some text";
encoded_input = encodeURIComponent(my_input).replace(/%20/g,'+');
好的,我会坚持我正在做的。由于提供了参考链接而接受此。 – OmidTahouri