Re: &-separator from a form

That last post didn't work too well, lets try that again:

At 08:15 PM 12/23/98 , kgeorge@tcpsoft.com wrote:
>Greg Marr wrote:
>> There is no need to URL-encode the ampersand.  It needs to be protected from
>> the HTML parser, not the network layers.  URL encoding it will only help if
you
>> write your script to handle it, and isn't a general-purpose solution.  Using
>> & instead of & will protect it from the HTML parser, which is all that
is
>> necessary.
>
>The original poster wanted to include the ampersand as part of the value
>of a name=value pair.  Since the ampersand is the name=value pair
>seperator in html, it is necessary to url encode it if you want an
>ampersand as part of the value.

I don't see that at all in the original post:

>Is there any way to define the separator (&) used when using a form ??(i.e.:
><form action=cgi.cgi method=get>
><input type=text name=one value="something">
><input type=text name=two value="another thing">
><input type=submit value="submit">
></form>
>
>would result in this
url:http://..../cgi-bin/cgi.cgi?one=something&two=another+thing
>
>The problem with this is, that & has a special meaning in HTML, so using such
an URL
>in a HTML-page is not perfect.
>I could use (i.e.) ; as a separator in the HTML-page, but still most UA's use
& when
>data is submitted trough a form. That's not very practical, having two
different
>separators.

 From my reading of it, he's asking how to put a URL containing name/value
pairs in an HREF or SRC attribute.

>If name: x and value: hello&goodbye the value must be encoded so the
>ampersand is not lost and goodbye is not treated as a new argument.

Correct, if the CGI that you are using automatically splits arguments that way.

>I believe this is what he was asking.

I don't believe so.

>The only thing that &amp; is good for is for use in web pages.  It can not be
>used for encoding a url because a) it contains the ampersand itself and b) it
is
>translated to a "&" before the form/url is queried.

Hence the purpose of using it in the first place.

>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.

--
Greg Marr
gregm@alum.wpi.edu
"We thought you were dead." 
"I was, but I'm better now." - Sheridan, "The Summoning"

Received on Monday, 28 December 1998 10:19:30 UTC