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: Tue, 5 Jan 1999 09:55:34 -0800
Message-Id: <v03130307b2b7fca3aa63@[134.79.129.61]>
To: www-html@w3.org
At 6:22a -0800 01/05/99, Greg Marr wrote:
>At 07:01 PM 1/4/99 , Walter Ian Kaye wrote:
>>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.
>
>That's not quite what I meant.  We were discussing:
>name1=value1&name2=value&with&ampersands&in&it&name3=value3
>
>How would your cgi handle that?

Well that's invalid anyway. But I guess you meant

  name1=value1;name2=value&with&ampersands&in&it;name3=value3

which would split to

  value1;name2
  value&with&ampersands&in&it;name3

Hmm... actually it seems my CGI would handle that example properly,
though only by accident. Turns out my code only looks at one item
rather than checking each item. If value2 were where value1 is, then
it would fail. So as long as the first value contains no ampersands,
then it works fine. I could make it smarter, but it's probably not
worth it. ;)

(Sorry folks, didn't expect to get so programmery.)


-Walter
Received on Tuesday, 5 January 1999 12:58:18 GMT

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