最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

url decode problem 解決方法

 更新時間:2011年12月26日 21:45:03   作者:  
今天被告訴了一個奇怪的事兒,第三方網站使用我們提供的簽名是出現了錯誤,原因是使用php的urldecode時把加號(+) 替換成了空格
試驗了一下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的文檔,發(fā)現有一個

rawurlencode() - URL-encode according to RFC 3986


也就是php又搞了rawurlencode和rawurldecode把標準實現了。。。。

不能反一下么,畢竟大部分人應該都會用urlencode。php真是蛋疼啊。。。。

相關文章

最新評論

东城区| 定日县| 黄冈市| 新兴县| 肥城市| 玛多县| 界首市| 彭阳县| 沙雅县| 田东县| 上思县| 赣州市| 怀仁县| 抚顺市| 沁阳市| 高淳县| 广东省| 兴业县| 张掖市| 广饶县| 苍溪县| 河北区| 深圳市| 奈曼旗| 区。| 墨竹工卡县| 突泉县| 平罗县| 沾益县| 灌南县| 斗六市| 甘肃省| 西城区| 衡南县| 正安县| 温宿县| 平湖市| 大关县| 五华县| 平果县| 台州市|