You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Hanisch <ha...@informatik.uni-muenchen.de> on 2000/07/28 12:46:27 UTC

[OT] & in URLs (was: Re: Templating System)

On 27 Jul 2000, Randal L. Schwartz wrote:

> >>>>> "Jacob" == Jacob Davies <ja...@sfinteractive.com> writes:
> 
> Jacob> Now as to ampersands used to separate form fields, like:
> 
> Jacob> 	<A HREF="/somehandler?email=jacob%40sfinteractive.com&name=Jacob">
> 
> Jacob> do you mean that it should be:
> 
> Jacob> 	<A HREF="/somehandler?email=jacob%40sfinteractive.com&amp;name=Jacob">
> 
> Jacob> instead?  That second one looks better now that I look at it,
> Jacob> but I confess that I invariably use the first one.
> 
> Then you are wrong. :) You need to have &amp; in there, so that the
> browser can turn it back from &amp; to & before sending the URL back
> up to your server (or whichever server comes along).

Are you really positive about this?
AFAIK (and I just looked it up in the HTML 3.2 spec :-) the <A> tag is
defined as follows:

(quoted from http://www.w3.org/TR/REC-html32#sgmldecl)

<!ELEMENT A - - (%text)* -(A)>
<!ATTLIST A
        name    CDATA   #IMPLIED    -- named link end --
        href    %URL    #IMPLIED    -- URL for linked resource --
        rel     CDATA   #IMPLIED    -- forward link types --
        rev     CDATA   #IMPLIED    -- reverse link types --
        title   CDATA   #IMPLIED    -- advisory title string --
        >
where %URL is:

<!ENTITY % URL "CDATA"
        -- The term URL means a CDATA attribute
           whose value is a Uniform Resource Locator,
           See RFC1808 (June 95) and RFC1738 (Dec 94).
        -->

So the HREF-attribute is CDATA, and not PCDATA (like "normal" text) - to
me this sounds like a plain "&" (ampersand character) is perfectly legal
in this place.
But then I'm no SGML wizz, so I might be wrong... 

(Sorry for sounding like a smart-ass ;-)

Regards,
	Michael.

________________________________________________________
Michael   |  email: hanisch@informatik.uni-muenchen.de 
Hanisch   |                                            
________________________________________________________