On Sun, Oct 11, 2009 at 5:29 AM, The Editor <[email protected]> wrote:
>
> On Sun, Oct 11, 2009 at 3:52 AM, Hans <[email protected]> wrote:
>
> > Re: & and XHTML
> > Please can you explain what the problem is with the '&' character and
> > XHTML compliance? Anything I can read up on this?
>
> I was just going by what Kevin said. Kevin, do you have the specs
> handy somewhere? Is it just forms we are talking about or page
> content? It doesn't make sense to me in terms of the latter, because
> there is an & in all escaped values and in some javascript. I think
> perhaps it is just the form inputs we need to be worried about. If
> anyone can verify this, I'll make the appropriate fixes.
>
>From WDG:
Another common error occurs when including a URL which contains an ampersand
("&"):
<!-- This is invalid! --> <a href="foo.cgi?chapter=1*§ion*=2*©*=3*
&lang*=en">...</a>
This example generates an error for "unknown entity *section*" because the
"&" is assumed to begin an
entity<http://htmlhelp.com/reference/html40/entities/>reference.
Browsers often recover safely from this kind of error, but real
problems do occur in some cases. In this example, many browsers correctly
convert *©=3* to *©=3*, which may cause the link to fail. Since
*⟨*is the
HTML entity for the left-pointing angle bracket, some browsers also convert
*&lang=en* to *〈=en*. And one old browser even finds the entity *§*,
converting *§ion=2* to *§ion=2*.
To avoid problems with both validators and browsers, always use *&* in
place of *&* when writing URLs in HTML:
<a href="foo.cgi?chapter=1*&*section=2*&*copy=3*&*
lang=en">...</a>
Note that replacing *&* with *&* is only done when writing the URL *in
HTML*, where "&" is a special character (along with "<" and ">"). When
writing the same URL in a plain text email message or in the location bar of
your browser, you would use "&" and *not* "&". With HTML, the browser
translates "&" to "&" so the Web server would only see "&" and not
"&" in the query string of the request.
Since & starts the encoding of special characters, if you want to use a & in
your page, you should use & instead.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---