Percent-encoding Reserved Characters
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 reserved character "/
", for example, if used in the "path" component of a URI, has the special meaning of being a delimiter between path segments. If, according to a given URI scheme, "/
" needs to be in a path segment, then the three characters "%2F
" or "%2f
" must be used in the segment instead of a raw "/
".
! |
# |
$ |
& |
' |
( |
) |
* |
+ |
, |
/ |
: |
; |
= |
? |
@ |
[ |
] |
%21 |
%23 |
%24 |
%26 |
%27 |
%28 |
%29 |
%2A |
%2B |
%2C |
%2F |
%3A |
%3B |
%3D |
%3F |
%40 |
%5B |
%5D |
Reserved characters that have no reserved purpose in a particular context may also be percent-encoded but are not semantically different from those that are not.
In the "query" component of a URI (the part after a ? character), for example, "/
" is still considered a reserved character but it normally has no reserved purpose, unless a particular URI scheme says otherwise. The character does not need to be percent-encoded when it has no reserved purpose.
URIs that differ only by whether a reserved character is percent-encoded or appears literally are normally considered not equivalent (denoting the same resource) unless it can be determined that the reserved characters in question have no reserved purpose. This determination is dependent upon the rules established for reserved characters by individual URI schemes.
Read more about this topic: Percent-encoding, Percent-encoding in A URI
Famous quotes containing the words reserved and/or characters:
“Parents ability to survive a childs unabating needs, wants, and demands...varies enormously. Some people can give and give....Whether children are good or bad, brilliant or just about normal, enormously popular or born loners, they keep their cool and say just the right thing at all times...even when they are miserable themselves, inexhaustible springs of emotional energy, reserved just for children, keep flowing unabated.”
—Stella Chess (20th century)
“His leanings were strictly lyrical, descriptions of nature and emotions came to him with surprising facility, but on the other hand he had a lot of trouble with routine items, such as, for instance, the opening and closing of doors, or shaking hands when there were numerous characters in a room, and one person or two persons saluted many people.”
—Vladimir Nabokov (18991977)