哪些字符会使 URL 无效? [英] Which characters make a URL invalid?

查看:32
本文介绍了哪些字符会使 URL 无效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些字符会使 URL 无效?

Which characters make a URL invalid?

这些网址是否有效?

  • example.com/file[/].html
  • http://example.com/file[/].html

推荐答案

通常由 RFC 定义的 URI3986(请参阅第 2 节:字符)可能包含任何以下 84 个字符:

In general URIs as defined by RFC 3986 (see Section 2: Characters) may contain any of the following 84 characters:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=

请注意,此列表并未说明这些字符可能出现在 URI 中的哪个位置.

Note that this list doesn't state where in the URI these characters may occur.

任何其他字符都需要使用百分比编码(%hh)进行编码.URI 的每一部分都进一步限制了哪些字符需要用百分比编码的词来表示.

Any other character needs to be encoded with the percent-encoding (%hh). Each part of the URI has further restrictions about what characters need to be represented by an percent-encoded word.

这篇关于哪些字符会使 URL 无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆