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

后端 未结 3 1961
悲&欢浪女
悲&欢浪女 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:01

    It uses percent encoding. You can see the Percent Encoding part of the RFC for Uniform Resource Identifier (URI): Generic Syntax

    A percent-encoding mechanism is used to represent a data octet in a component when that octet's corresponding character is outside the
    allowed set or is being used as a delimiter of, or within, the
    component. A percent-encoded octet is encoded as a character
    triplet, consisting of the percent character "%" followed by the two
    hexadecimal digits representing that octet's numeric value. For
    example, "%20" is the percent-encoding for the binary octet
    "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space
    character (SP).

提交回复
热议问题