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, (ckemp@ro.com); or "http://ro.com/~ckemp".
 Do you like my home page?

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

My+name+is+Chris%2C+%28ckemp%40ro%2Ecom%29%3B+or+%22http%3A%2F%2Fro%2Ecom%2F%7Eckemp%22%2E
 +Do+you+like+my+home+page%3F

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
Advertisement: