It is one of those things that we use frequently, yet we don't know/care how it works.
/ have significant meanings in a URI. So what happens if, somehow, my query string contains such characters? This is where percent-encoding comes in. Percent-encoding is a process that converts reserved characters into something like
encodeURIComponent; in Ruby on Rails this is handled automagically by the
How it is actually done
Percent-encoding is a simple two-step process:
Convert each reserved character to
%follow by its ASCII value in hexadecimal. For example,
!should be translated to
%3A. Following are the list of all reserved characters:
: / ? # [ ] @ ! $ & ' ( ) * + , ; =
Convert each space character to
It is not difficult to see that a percent-encoded string can unambiguously be decoded to its original string.