Decoding your arguments
The server does all the work when you use the Windows CGI Interface!
Get the hint?
When the server sends you a query string, it encodes them in URL format.
This means:
- spaces are changed into ' + '
- Special characters are encoded by %xx, where xx is the
hexadecimal number of their ASCII equivalent
Sample Code
Here are some C functions to do this for you. Hopefully,
you can translate these into whatever shell or
interpreter language you are using (forget COMMAND.COM!).
void plustospace(char *str)
{
register int x;
for(x = 0; str[x]; x++)
if(str[x] == '+')
str[x] = ' ';
}
void unescape_url(char *url)
{
register int x, y;
for(x=0, y=0; url[y]; ++x, ++y)
{
if((url[x] = url[y]) == '%')
{
url[x] = x2c(&url[y+1]);
y+=2;
}
}
url[x] = '\0';
}
char x2c(char *what)
{
register char digit;
digit = ((what[0] >= 'A') ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
digit *= 16;
digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A')+10 : (what[1] - '0'));
return(digit);
}
Move on to output headers
Return to GET
script overview
Robert B. Denny <rdenny@netcom.com>