A Uniform Resource Identifier (URI) is a string that identifies a resource, such as a web page, text document, or image. URLs are an easy way to access these resources through the HTTP Protocol. RFC2396 defines the syntax of a URI. Included in this syntax are several reserved or excluded characters that cannot and/or should not be used in a URI. If these characters are needed, their escape sequence should be used instead.

To use an escape code, simple convert the character's ASCII value to its hexadecimal equivalent, and prefix it with a percent sign (%). Replace the character with this new value (%xx) in the URL. Below are the commonly used escape sequences:

             Escape    |               Escape
Character    Sequence  |  Character    Sequence
Space        %20       |  ;            %3B
&            %26       |  =            %3D
<            %3C       |  ?            %3F
>            %3E       |  @            %40
"            %22       |  [            %5B
#            %23       |  \            %5C
$            %24       |  ]            %5D
%            %25       |  ^            %5E
'            %27       |  `            %60
+            %2B       |  {            %7B
,            %2C       |  |            %7C
/            %2F       |  }            %7D
:            %3A       |  ~            %7E

You are certainly not limited to using the escape sequences for reserved characters only. In fact, you can use them to obfusticate your URL. For example, you can get to this node by entering the following URL in your browser:

(i.e., http://everything2.com/index.pl?node=URL escape sequences)

Some web browsers* may even let you get away with something like this:

http://%65%76%65%72%79%74%68%69%6e%67%32%2e%63%6f%6d/%69%6E%64%65%78%2E%70%6C?%6E%6F%64%65= %55%52%4C%20%65%73%63%61%70%65%20%73%65%71%75%65%6E%63%65%73

* As of this writeup, the current versions of IE, Konqueror, and Opera could handle this.

Reference: RFC 2396

Log in or register to write something here or to contact authors.