The Architecture of Percent-Encoding (RFC 3986)
Uniform Resource Identifiers (URIs) are constrained to a restricted subset of the US-ASCII character repertoire. Characters permitted in URIs are divided into reserved and unreserved characters.
Unreserved characters include uppercase and lowercase English letters, decimal digits, and four special punctuation marks: hyphens (-), underscores (_), periods (.), and tildes (~). All other characters—including whitespace, non-ASCII Unicode characters, and reserved structural delimiters—must undergo percent-encoding when included in arbitrary component slots.
How Percent Encoding Operates
During the encoding process, each non-conforming character is first converted into its UTF-8 octet byte sequence. Each byte is then represented by a percent character (%) followed by a two-digit hexadecimal representation of that byte value. For instance, the UTF-8 byte for an ASCII space is decimal 32, which converts to hexadecimal 20, yielding %20.