W3C home > Mailing lists > Public > www-validator@w3.org > October 2013

Re: Error Message. & did not start a character reference. (& probably should have been escaped as &.)

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sun, 27 Oct 2013 00:26:17 +0300
Message-ID: <526C3379.10006@cs.tut.fi>
To: "www-validator@w3.org" <www-validator@w3.org>, CEO nativapps <ceo@nativapps.com>
2013-10-26 23:43, David Dorward wrote:

> On 26 Oct 2013, at 1:27, CEO nativapps wrote:
>> I was checking www.nativapps.com and the W3C checker give me this error:
>>
>> & did not start a character reference. (& probably should have been
>> escaped as &amp;.)
>>
>> This is not an error
>
> Yes, it is.
>
>> because we are using href
>
> That makes no difference. You are representing the URL in an HTML
> document not in plain text. & should be expressed as &amp;.

That was/is the rule in HTML 4.01, but the page has <!DOCTYPE html>, so 
it is validated as HTML5. The rules of HTML5 have changed during the 
years, but the current wording allows a naked “&” in an attribute value 
if it is not followed by an identifier that is the name of a named 
character reference. This is in accordance with browser practices.

The validator is now in error in this issue, but its authors seem to 
refuse to fix it, since they think that the “specification” (HTML5 
draft) should be fixed instead.

In practice, you can ignore these error messages. Alternatively, replace 
“&” by “&amp;”. It’s *allowed* in HTML5 too to always represent the “&” 
that way. The downside is that the attribute values look a bit more 
messy, and there is always a risk of making mistakes when doing 
replacements like that.

Yucca
Received on Saturday, 26 October 2013 21:26:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:09 UTC