国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

url decode problem 解決方法

2024-05-04 23:16:19
字體:
來源:轉載
供稿:網友
試驗了一下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真是蛋疼啊。。。。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 龙游县| 阜南县| 昌宁县| 精河县| 开原市| 靖远县| 定西市| 四平市| 安龙县| 吴桥县| 四子王旗| 泽库县| 克什克腾旗| 英德市| 米泉市| 康定县| 区。| 威海市| 广平县| 涡阳县| 易门县| 长宁区| 太和县| 聂荣县| 井陉县| 溧水县| 浦城县| 寿宁县| 余干县| 大竹县| 桑植县| 胶南市| 张家界市| 华池县| 苍溪县| 乐陵市| 平顶山市| 定边县| 苏尼特左旗| 舞钢市| 台南市|