hint: [Bug] Incorrect hint on location of charset defintion

The browser extension complains:

‘charset’ meta element should be the first thing in ‘<head>’.

This is not true, and is widely misunderstood (and sadly so). The element containing the character encoding declaration must be within the first 1024 bytes of the document. There is nothing in the specs mandating that it be the first thing in the head element. It is therefore perfectly valid for it to follow the title element, for example, so long as it is still within the first 1024 bytes of the document.

See for reference:

https://www.w3.org/TR/html52/document-metadata.html#character-encoding-declaration

https://www.w3.org/International/questions/qa-html-encoding-declarations

Please revise the analysis engine to see if the charset is within the first 1024 bytes of the html document.

Many thanks! Tom

🐛 Bug report

Description

Environment

  • webhint version:
  • Browser version:
  • URL for which webhint failed:

webhint configuration

webhint’s configuration

Categories:

  • Accessibility
  • Compatibility
  • Performance
  • Pitfalls
  • PWA
  • Security

Your target browsers:

  • Recommended settings
  • Custom:

Ignored resources:

  • None
  • Different origin
  • Custom:

Debug output

Please include the content of the Error details section if an error message was displayed.

webhint’s Error details
<!-- ✍️ Paste the error details here -->


About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 19 (12 by maintainers)

Most upvoted comments

If it gets approved the next big thing will be to classify all the severity for the different warnings. Maybe someone else from Mozilla can chime in to have different PoV? Maybe from MDN?

Sure, @Elchi3 comes to mind. Should they chime in here or https://github.com/webhintio/hint/pull/2968?