我注意到这些字符都是非法的
#%<>?\/*+|:"
我注意到这些是编码的(%NN,其中 NN 是十六进制值)但可以毫无问题地替换
$,;=& @
(注意通常编码为
+
的空格(但可能是 %20))#%?/+
我明白。但是以下字符有什么作用呢? <>\*|":
注:我懂什么
:
在域部分(它的端口)中,@ 是一个登录名,但在第一个/为什么之后:非法? (@不是)
最佳答案
RFC 2396 (Uniform Resource Identifiers URI: Generic Syntax)说:
Many URI include components consisting of or delimited by, certain special characters. These characters are called "reserved", since their usage within the URI component is limited to their reserved purpose.
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
2.4.3. Excluded US-ASCII Characters
The angle-bracket "<" and ">" and double-quote (") characters are excluded because they are often used as the delimiters around URI in text documents and protocol fields. The character "#" is excluded because it is used to delimit a URI from a fragment identifier in URI references (Section 4). The percent character "%" is excluded because it is used for the encoding of escaped characters.
delims = "<" | ">" | "#" | "%" | <">
Other characters are excluded because gateways and other transport agents are known to sometimes modify such characters, or they are used as delimiters.
unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"
我认为这涵盖了你提到的所有内容。星号“
*
”不是保留的,可以使用。将此粘贴到浏览器中:http://en.wikipedia.org/wiki/ *
关于language-agnostic - URL 中特定保留字符背后的基本原理是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4581307/