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

Re: &-separator from a form

From: <kgeorge@tcpsoft.com>
Date: Wed, 23 Dec 1998 20:19:08 -0500 (EST)
Message-ID: <36819598.6C508021@tcpsoft.com>
To: Greg Marr <gregm@alum.wpi.edu>
CC: www-html@w3.org
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
> &amp; 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.

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.  I
believe this is what he was asking.  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.

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.

Kyle George
Received on Monday, 4 January 1999 03:08:20 UTC

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