尝试从Python移植一段代码:
my_input = "this&is£some text"
encoded_input = urllib.quote_plus(str(my_input))
…到JavaScript:
^{pr2}$微小的区别是urllib.quote_plus()
将把空格转换成{
var my_input = "this&is£some text";
encoded_input = encodeURIComponent(my_input).replace(/%20/g,'+');
在Python代码中使用^{} ,而不是}是首选方法(reference, second paragraph in Description)。在
quote_plus()
。如果改变Python代码不是一个解决方案,那么选择用+
替换{相关问题 更多 >
编程相关推荐