且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是有效的URL查询字符串?

更新时间:2023-11-26 21:22:28

http://tools.ietf.org/html/rfc3986

在2.2保留字符中,列出了以下字符:

In section 2.2 Reserved Characters, the following characters are listed:


reserved = gen-delims / sub-delims

reserved = gen-delims / sub-delims

gen-delims =:///?/#/[/] /@

gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"

sub-delims =!/$/&/'/(/)/ */+/,/;
/=

sub-delims = "!" / "$" / "&" / "’" / "(" / ")" / "*" / "+" / "," / ";" / "="

规范然后说:


如果URI组件的数据与作为分隔符的保留字符的
目的冲突,则冲突数据必须为$在形成URI之前b $ b百分比编码。

If data for a URI component would conflict with a reserved character’s purpose as a delimiter, then the conflicting data must be percent-encoded before the URI is formed.

接下来,在2.3节预留字符中,列出以下内容:

Next, in section 2.3 Unreserved Characters, the following are listed:


unreserved = ALPHA / DIGIT / - /。/_/〜

unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"