[英]Characters a URL can't end with?
What characters (if any) can a web browser URL (http/https) not end with? Web浏览器URL(http / https) 不能以什么字符(如果有)结尾?
As far as I can tell, control characters aren't used eg 据我所知,不使用控制字符,例如
\\0
nil. \\0
无。 \\t
tab. \\t
标签。 \\n
newline. \\n
换行符。 Is there a complete list of such characters? 是否有此类字符的完整列表?
There are three cases how a URI can end: URI如何结束有以下三种情况:
with the path component (if it has no query/fragment) 与路径组件(如果没有查询/片段)
http://example.com/ http://example.com/path http://example.com/path/path
with the query component (if it has no fragment) 与查询组件(如果没有片段)
http://example.com/?query http://example.com/path?query http://example.com/path/path?query
with the fragment component 与片段成分
http://example.com/#fragment http://example.com/path#fragment http://example.com/path/path#fragment http://example.com/?query#fragment http://example.com/path?query#fragment http://example.com/path/path?query#fragment
The URI standard doesn't place any restrictions on the end of these three components ( Path , Query , Fragment ), so the same characters are allowed that can appear anywhere else in the components: URI标准对这三个组件( Path , Query , Fragment )的末尾没有任何限制,因此允许出现在组件其他任何位置的相同字符:
space (from testing seems this is stripped)
空间(从测试看来这已被剥离)
URIs can have (multiple) space characters at the end (in all three cases), but they have to be percent-encoded. URI的末尾(在所有三种情况下)都可以有(多个)空格字符,但是必须对它们进行百分比编码。 Spaces aren't allowed unencoded, no matter where.
无论在何处,都不允许对空格进行未编码。
http://example.com/path-ending-with-four-spaces-%20%20%20%20
If a user agent tries to convert user input into a valid URI (ie, percent-encoding all characters that can't appear in the component), it might assume that trailing spaces aren't intended to be part of the URI, and strip them. 如果用户代理尝试将用户输入转换为有效的URI(即,对不能出现在组件中的所有字符进行百分比编码),则可能会假定尾随空格不打算作为URI的一部分,并删除他们。
The same goes for tab and newline characters. 制表符和换行符也是如此。 They can be part of URIs if percent-encoded.
如果进行百分比编码,则它们可以是URI的一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.