url decode problem 解决方法

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了url decode problem 解决方法脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

试验了一下python的urllib库以及js 的 encodeURIcomponent 均不会替换。空格encode也是替换成了 '%20' 。python提供了urllib.quote_plus,urlib.unquote_plus来处理空格->加号,看起来还是比较合理的。 查了一下 Rfc 3986: 有下面一段 Scheme names consist of a sequence of characters beginning wITh a letter and followed by any combination of letters,digits,plus ("+"),PEriod ("."),or hyphen ("-").
RFC 2396 有下面的一段 The plus "+",dollar "$",and comma "," characters have been added to those in the "reserved" set,since they are treated as reserved within the query component.
表示加号已经是url的保留字了,不需要转义。 然后htML4文档里才有关于加号的转义: application/x-www-form-urlencoded
Forms submitted with this content type must be encoded as follows:
Control names and values are escaped. Space characters are replaced by`+',and then reserved characters.....
声明只有content-type为application/x-www-form-urlencoded时才会对+做转义。 又翻了下PHP的文档,发现有一个 rawurlencode() - URL-encode according to RFC 3986
也就是PHP又搞了rawurlencode和rawurldecode把标准实现了。。。。 不能反一下么,毕竟大部分人应该会用urlencode。PHP真是蛋疼啊。。。。

脚本宝典总结

以上是脚本宝典为你收集整理的url decode problem 解决方法全部内容,希望文章能够帮你解决url decode problem 解决方法所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:decode