Re: Problems with & in URIs

On Sun, 19 Sep 1999 17:41:01 -0400 (EDT), Tim Clapp
(tcc1000@eng.cam.ac.uk) wrote:
> 
> I get a lot of moans from the validator for URIs which contain &
> characters: these are passed as arguments to a cgi script on another
> site. The validator complains that the entity is not defined: surely
> this should only happen on the body of the html, not in a URI. See
> www.croftguesthouse.co.uk for an example. I hope is is correct and this
> is a bug in the parser. Please let me know otherwise.

This is not a bug.  Entities are allowed in attribute values.  If you
want to link to the URL:

http://foo.com/search?keyword=food&time=today

you can do so by using the & entity:

<a href="http://foo.com/search?keyword=food&amp;time=today">Today's food</a>

Every browser I've tested this on (probably something like NN 4.x, IE
5.0, and Opera 3.6) handled it correctly.  I'm not sure how far you
must go back in history to find one that doesn't.

David

L. David Baron    Sophomore, Harvard (Physics)    dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.     <URL: http://www.fas.harvard.edu/~dbaron/ >
WSP CSS AC                      <URL: http://www.webstandards.org/css/ >

Received on Sunday, 19 September 1999 19:16:17 UTC