It’s called percent encoding. Some characters can’t be in a URI (for example #
, as it denotes the URL fragment), so they are represented with characters that can be (#
becomes %23
)
Here’s an excerpt from that same article:
When a character from the reserved set (a “reserved character”) has special meaning (a “reserved purpose”) in a certain context, and a URI scheme says that it is necessary to use that character for some other purpose, then the character must be percent-encoded. Percent-encoding a reserved character involves converting the character to its corresponding byte value in ASCII and then representing that value as a pair of hexadecimal digits. The digits, preceded by a percent sign (“%”) which is used as an escape character, are then used in the URI in place of the reserved character. (For a non-ASCII character, it is typically converted to its byte sequence in UTF-8, and then each byte value is represented as above.)
The space character’s character code is 32
:
> ' '.charCodeAt(0) 32
Which is 20
in base-16:
> ' '.charCodeAt(0).toString(16) "20"
Tack a percent sign in front of it and you get %20
.