This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12054 - clearly state that there must be only one character encoding declaration in a document
Summary: clearly state that there must be only one character encoding declaration in a...
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-13 19:19 UTC by Michael[tm] Smith
Modified: 2011-08-04 05:16 UTC (History)
5 users (show)

See Also:


Attachments

Description Michael[tm] Smith 2011-02-13 19:19:42 UTC
Problem One: There does not seem to be any clearly stated normative document-conformance requirement in the spec that prohibits a document from containing multiple meta elements with an http-equiv attribute in the Encoding declaration state.

The relevant document-conformance requirements that the spec does normatively state are:

  A. "There must not be more than one meta element with a charset attribute per document."

  B. "If the document contains a meta element with an http-equiv attribute in the Encoding declaration state, then the document must not contain a meta element with the charset attribute present."

Problem Two:  Statement B above makes it sound as if a character encoding declaration given by a meta element with an http-equiv attribute in the Encoding declaration state always takes precedence over a character encoding declaration given by a meta element with a charset attribute. That is, it would seem to require that even if a meta element with a charset attribute occurs in document order before a meta element with an http-equiv attribute in the Encoding declaration state, then the meta element with a charset attribute should be reported as an error. Which seems wrong.

Suggested fix:

I do see that the definition of "character encoding declaration" includes a bulleted list prefixed with "The following restrictions apply to character encoding declarations", and an items in that list that reads, "There can only be one character encoding declaration in the document."

http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#character-encoding-declaration

Is that meant to be a normative document-conformance requirement? Or if not, could it please be made into one? e.g., "There must be only one character encoding declaration in the document."

If the spec clearly states "There must be only one character encoding declaration in the document" somewhere, then there would be no need for either statement A or B above, and they could just be removed, and then Problems One and Two above go away also.
Comment 1 Yuhong Bao 2011-03-06 06:54:51 UTC
Yea, the Slashdot redesign once had such an error:
http://meta.slashdot.org/comments.pl?sid=1965970&cid=35003738
Comment 2 Ian 'Hixie' Hickson 2011-05-04 18:16:14 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: see diff given below
Rationale: 

> Problem One: There does not seem to be any clearly stated normative
> document-conformance requirement in the spec that prohibits a document from
> containing multiple meta elements with an http-equiv attribute in the Encoding
> declaration state.

"There must not be more than one meta element with any particular state in the document at a time."

> Problem Two:  Statement B above makes it sound as if a character encoding
> declaration given by a meta element with an http-equiv attribute in the
> Encoding declaration state always takes precedence over a character encoding
> declaration given by a meta element with a charset attribute.

It doesn't talk about precedence, it's just prohibiting both from being present at once.

> That is, it would
> seem to require that even if a meta element with a charset attribute occurs in
> document order before a meta element with an http-equiv attribute in the
> Encoding declaration state, then the meta element with a charset attribute
> should be reported as an error. Which seems wrong.

It just requires that in that case an error be reported, nothing in the spec requires specific validator UI. You could report a completely unrelated error, so long as you don't say the doc is conforming.

I've tried to clarify it, though.

> Suggested fix:
> 
> I do see that the definition of "character encoding declaration" includes a
> bulleted list prefixed with "The following restrictions apply to character
> encoding declarations", and an items in that list that reads, "There can only
> be one character encoding declaration in the document."
> 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#character-encoding-declaration
> 
> Is that meant to be a normative document-conformance requirement?

It isn't. I've tried to clarify it.


> Or if not,
> could it please be made into one? e.g., "There must be only one character
> encoding declaration in the document."

That would prevent the XML character encoding declaration from co-existing with a <meta charset> character encoding declaration, which is explicitly allowed to ease migration.
Comment 3 contributor 2011-05-04 18:19:12 UTC
Checked in as WHATWG revision r6061.
Check-in comment: Try to clarify some requirements for the validator.
http://html5.org/tools/web-apps-tracker?from=6060&to=6061
Comment 4 Michael[tm] Smith 2011-08-04 05:16:08 UTC
mass-move component to LC1