W3C home > Mailing lists > Public > www-html@w3.org > January 1999

Re: &-separator from a form

From: Walter Ian Kaye <walter@natural-innovations.com>
Date: Mon, 4 Jan 1999 16:01:11 -0800
Message-Id: <v03130301b2b703bf30ac@[134.79.129.61]>
To: www-html@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:38 GMT