CGI and Perl

Table 5.2. URI Characters That Must Be Encoded.

Character URI Encoded HEX Equivalent
Tab %09
Space %20
" %22
# %23
% %25
& %26
( %28
) %29
, %2C
. %2E
/ %2F
: %3A
; %3B
< %3C
= %3D
> %3E
? %3F
@ %40
[ %5B
\ %5C
] %5D
^ %5E
' %60
{ %7B
| %7C
} %7D
~ %7E
So, if someone typed the following into a text field form:
My name is Chris, (; or "".
 Do you like my home page?

Netscape (or whatever) would encode it and send it to your CGI as:


The special characters are simply replaced with their HEX equivalents. Headers In a FullRequest, the browser may also send a series of headers in RFC-822 format. The most common headers are Accept, which tells the server which MIME object types the browser can handle, and User-Agent, which gives the type and version of the browser. These headers are placed into the environment of your script by the Web server when your script is run, then some additional variables are added to your environment by the Web server. Thus, the variables in Table 5.3 are available to your script.

by BrainBellupdated