Re: Amaya mishandling HREF values that contain ampersand

On Tue, 6 Jul 1999, Malcolm Austen wrote:

> On Tue, 6 Jul 1999, Alan J. Flavell wrote:
> 
> + The archive contains a message
> + http://lists.w3.org/Archives/Public/www-amaya/1999AprJun/0082.html
> 
> I don't recall the message and the archive has just timed out on me ...
> 
> + I recently got involved elsewhere in a discussion of this issue, i.e
> + when forming an HREF to a URL that contains an ampersand, the need to
> + represent the ampersand as & .  In general, omitting to do so will
> + result in failure of HTML syntax validation (on the grounds of an
> + undefined entity), as I'm sure is well known.  But after writing &
> + the HREF no longer works correctly in Amaya.
> 
> Surely, in a URL an ampersand is escaped as %26 ?
> 
> & is the escape in html and the (quoted) string value in an href isn't
> html. Does it need to be escaped in the URL? - I haven't checked the rules
> but don't the quotes protect it from the (html) "&" escape mechanism?

  B.2.2 Ampersands in URI attribute values  
   
   The URI that is constructed when a form is submitted may be used as an
   anchor-style link (e.g., the href attribute for the A element).
   Unfortunately, the use of the "&" character to separate form fields 
   interacts with its use in SGML attribute values to delimit character
   entity references. For example, to use the URI "http://host/?x=1&y=2"
   as a linking URI, it must be written <A
   href="http://host/?x=1&#38;y=2"> or <A 
   href="http://host/?x=1&amp;y=2">.
   
   We recommend that HTTP server implementors, and in particular, CGI
   implementors support the use of ";" in place of "&" to save authors
   the trouble of escaping "&" characters in this manner.
  
     -- HTML 4.0 Specification.


Ewan Mellor.

Received on Tuesday, 6 July 1999 09:27:11 UTC