Percent-Encoding Explained: How %20 and Friends Work
Percent-encoding (URL encoding) replaces unsafe characters with %XX sequences. Learn how the hex values are derived, RFC 3986 rules, and edge cases.
Published:
Tags: encoding, url, developer-tools
Percent-Encoding Explained: How %20 and Friends Work You have seen in a URL. You probably know it represents a space. But do you know why it is specifically, how multi-byte characters like turn into three percent sequences, or why the same space sometimes appears as instead? This post answers all of that, from the byte level up. --- The Basic Mechanism Percent-encoding replaces a character with a followed by two uppercase hexadecimal digits representing the byte value of that character in ASCII or UTF-8. Space has ASCII code 32. 32 in hexadecimal is . So space becomes . The character has ASCII code 60. 60 in hex is . So becomes . Hexadecimal digits are case-insensitive in the spec ( and are equivalent), but RFC 3986 recommends uppercase. Most libraries and tools produce uppercase hex. ---…
All articles · theproductguy.in