Which characters make a URL invalid?

后端 未结 10 1241
小蘑菇
小蘑菇 2020-11-21 05:03

Which characters make a URL invalid?

Are these valid URLs?

  • example.com/file[/].html
  • http://example.com/file[/].html<
10条回答
  •  盖世英雄少女心
    2020-11-21 05:50

    All valid characters that can be used in a URI (a URL is a type of URI) are defined in RFC 3986.

    All other characters can be used in a URL provided that they are "URL Encoded" first. This involves changing the invalid character for specific "codes" (usually in the form of the percent symbol (%) followed by a hexadecimal number).

    This link, HTML URL Encoding Reference, contains a list of the encodings for invalid characters.

提交回复
热议问题