NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 589 - Prohibit Duplicate Charset Declarations
Prohibit Duplicate Charset Declarations
Status: RESOLVED MOVED
Product: Validator.nu
Classification: Unclassified
Component: General
HEAD
All All
: P2 normal
Assigned To: Michael[tm] Smith
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-30 15:51 CEST by Smylers
Modified: 2016-02-04 17:48 CET (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Smylers 2009-06-30 15:51:02 CEST
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>
Comment 1 Philip Taylor 2011-02-12 21:40:16 CET
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."
Comment 2 Michael[tm] Smith 2011-02-13 12:02:27 CET
(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.
Comment 3 Michael[tm] Smith 2011-04-19 11:19:18 CEST
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.
Comment 4 Michael[tm] Smith 2011-05-25 14:19:01 CEST
see related spec change:

http://html5.org/r/6061
Comment 5 Michael[tm] Smith 2016-02-04 17:48:13 CET
Moved to https://github.com/validator/validator/issues/236