W3C home > Mailing lists > Public > www-html@w3.org > December 1998

Re: &-separator from a form

From: Greg Marr <gregm@alum.wpi.edu>
Date: Mon, 28 Dec 1998 10:22:15 -0500
Message-Id: <4.1.19981228102104.00e5f010@pop.ma.ultranet.com>
Message-Id: <4.1.19981228102104.00e5f010@pop.ma.ultranet.com>
To: kgeorge@tcpsoft.com
Cc: www-html@w3.org
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
>> write your script to handle it, and isn't a general-purpose solution.  Using
>> &amp; instead of & will protect it from the HTML parser, which is all that
>> 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">
>would result in this
>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

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:49 UTC