Description
This rule determines if the charset is set for HTML and if it’s defined within the first 1024 bytes of the HTML.
Purpose
Always declare the encoding of your document using a meta element with a charset
attribute, or using the http-equiv
and content
attributes (called a pragma directive). The declaration should fit completely within the first 1024 bytes at the start of the file, so it’s best to put it immediately after the opening <head>
tag.
How to fix it
- Define
<meta charset="utf-8"/>
or<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
within the first 1024 bytes at the start of the file. Ideally immediately after the opening<head>
tag
Standard
SiteLint, Quality, Best Practice