The origin on why ' ' is used as a space in URLs

后端 未结 3 1969
悲&欢浪女
悲&欢浪女 2020-12-09 07:44

I am interested in knowing why \'%20\' is used as a space in URLs, particularly why %20 was used and why we even need it in the first place.

3条回答
  •  佛祖请我去吃肉
    2020-12-09 08:06

    Because URLs have strict syntactic rules, like / being a special path separator character, spaces not being allowed in a URL and all characters having to be a certain subset of ASCII. To embed arbitrary characters in URLs regardless of these restrictions, bytes can be percent encoded. The byte x20 represents a space in the ASCII encoding (and most other encodings), hence %20 is the URL-encoded version of it.

提交回复
热议问题