W3C home > Mailing lists > Public > www-validator@w3.org > August 2014

"& did not start a character reference."

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Wed, 27 Aug 2014 11:06:31 +0300
Message-ID: <53FD9187.1030801@cs.tut.fi>
To: www-validator@w3.org
2014-08-26 12:45, Neil Whitehead wrote
under Subject: Re: [VE][html5] Add Subject Here:

> I have received the error:
>
> “& did not start a character reference. (& probably should have been
> escaped as &amp;.)”
>
> But the & was part of a url within a href=””, I am thinking there should
> be an exception for this?

For HTML5, the issue is messy and varies from draft to draft. Currently, 
in W3C HTML5 LC, the description of HTML parsing (!) rules at
http://www.w3.org/TR/html5/syntax.html#consume-a-character-reference
seem to say, in a fairly complicated manner, that e.g. &display=1 in an
attribute value causes “parse error” – even though browsers are required 
to process it so that “&” is taken as just a data character.

> Validating http://www.whitelayer.co.uk/p2/

Just replace any occurrence of “&” in an attribute value by “&amp;” 
(unless the “&” is meant to be part of a character reference).

This won’t change anything in page behavior, but it pleases the Validator.

Yucca
Received on Wednesday, 27 August 2014 08:07:04 UTC

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