Characters allowed in a URL

前端 未结 9 920
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 05:33

Does anyone know the full list of characters that can be used within a GET without being encoded? At the moment I am using A-Z a-z and 0-9... but I am looking to find out th

9条回答
  •  伪装坚强ぢ
    2020-11-22 06:33

    RFC3986 defines two sets of characters you can use in a URI:

    • Reserved Characters: :/?#[]@!$&'()*+,;=

      reserved = gen-delims / sub-delims

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

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

      The purpose of reserved characters is to provide a set of delimiting characters that are distinguishable from other data within a URI. URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent.

    • Unreserved Characters: A-Za-z0-9-_.~

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

      Characters that are allowed in a URI but do not have a reserved purpose are called unreserved.

提交回复
热议问题