DIVs vs. Tables

Float Layouts

Inline Blocks

Block Layouts


Split Bkgrd

Graphic Borders

Horizontal Lists

CSS Colors


Block IPs

Down for Maintenance

Page Redirect

Custom Error Pages

Escaping query strings

PNG transparency

Google App testing

Flash Optimizing

Avoid AS Statics

SEO Optimization

Escaping in a Query String

As you are probably aware HTML requires that the ampersade character & be typed out as &. This must also be done in URLs:

The address:


URL contains an ampersade

What happens when the query string contains a ampersade? For example: & bytes

In the example above the category is "bits & bytes" but since query strings recognize the ampersade as a field delimitor we have a problem. HTTP (which the descibes how a URL should look) has solution. The ampersade that is not a delimitor in the query string should be escaped into URL encoding. As, incidently, should spaces. An ampersade can be represented in a URL as %26. A space as %20. Therefore, the solution to the problem above is:

The anchor might look like this:

<a href=''>Show Category</a>

The follow table shows useful escape codes for use in URL query string.

Normal Character Encoding Character
 (space) %20
& %26
' (single quote) %27
" %22
? %3F
= %3D
+ %2B
% %25

Did you find this article userful for your website?
If so, why not provide a link to it? Just copy the following to your web page:

<a href=''>Escaping query strings</a>