Re: &-separator from a form

At 7:22a -0800 12/28/98, Greg Marr wrote:

>>If you want to have name=value&thisvalue as a name value pair, the
>>_only_ way to accomplish this is to say name=value%26thisvalue and then
>>decode it in your cgi program.
>
>or have a CGI that is smart enough to tell the difference, but that's probably
>a much more difficult solution.


Actually it's pretty easy -- my CGI library routine counts the '&'s and ';'s
between each name=value pair, and compares the counts to determine the
separator. Unless there are more ';'s than '&'s, the '&' is used.
So, an input like

   foo=bar;baz=foo&bar&foobar

will easily be recognized as using a ';' separator, since there is
only one separator between the pairs, and it's a semicolon.
(Perl-wise, I split on the '='s, discard the ends of the list, and
then check the contents of the remaining list items.)


-Walter

Received on Monday, 4 January 1999 19:03:04 UTC