Bugzilla – Bug 589
Prohibit Duplicate Charset Declarations
Last modified: 2016-02-04 17:48:13 CET
The spec says: “There can only be one character encoding declaration in the document†but this doesn't seem to be checked for; this document validates despite having 4 charset declarations: <!DOCTYPE html> <meta charset=utf-8> <meta charset=utf-8> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title></title>
That spec statement is not a normative requirement. I think the relevant requirements are: "There must not be more than one meta element with a charset attribute per document." "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."
(In reply to comment #1) > I think the relevant requirements are: > > "There must not be more than one meta element with a charset attribute per > document." > > "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." hmm, I thought the assertions code was already doing this check but I guess not. Should be easy enough to add, anyway. I'll take a shot a writing it up later today.
http://www.w3.org/Bugs/Public/show_bug.cgi?id=12054 I'm waiting on Hixie to respond to that and hopefully make a spec change, then based on that I can write up a proper check in the validator code.
see related spec change: http://html5.org/r/6061
Moved to https://github.com/validator/validator/issues/236