HTML Checking for Large Sites
Rocket Validator automatically checks your pages on the W3C Validator.
HTML issues tagged as charset.
The <meta charset>
is expected to appear at the beginning of the document, within the first 1024 bytes. Move it to the beginning of the <head>
section, as in this example:
<head>
<meta charset="utf-8">
...
</head>
A character encoding declaration is a mechanism by which the character encoding used to store or transmit a document is specified. For HTML documents, the standard way to declare a document character encoding is by including a <meta>
tag with a charset
attribute, typically <meta charset="utf-8">
.
According to the W3C standard:
The element containing the character encoding declaration must be serialized completely within the first 1024 bytes of the document.
Source:
In order to define the charset encoding of an HTML document, both of these options are valid, but only one of them must appear in the document:
<!-- This is the preferred way -->
<meta charset="UTF-8">
<!-- This is the older way, also valid -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Read about specifying the character encoding
The <meta charset>
tag, used to define the character encoding, must appear only once in a document, within the <head>
section.
Learn more:
A <meta>
tag has been found that is either malformed, or in a bad place within the document. Check its attributes and context.
For example, the following HTML contains a valid <meta>
tag that is raising an issue because of bad context, caused by an <img>
tag that shouldn’t be there:
<!DOCTYPE html>
<html lang="">
<head>
<title>Test</title>
<img src="photo.jpg" alt="A smiling cat" />
<meta charset="utf-8" />
</head>
<body>
<p>Some content</p>
</body>
</html>
If we fix that document and move the <img>
tag within the body, the issue raised about <meta>
disappears because it’s now in a valid context:
<!DOCTYPE html>
<html lang="">
<head>
<title>Test</title>
<meta charset="utf-8" />
</head>
<body>
<p>Some content</p>
<img src="photo.jpg" alt="A smiling cat" />
</body>
</html>
Learn more:
A <meta>
tag has been found in the document stating that the charset is windows-1251
, but it actually is utf-8
. You should update the tag to reflect the actual encoding of the document, for example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
A <meta>
tag has been found in the document stating that the charset is windows-1252
, but it actually is utf-8
. You should update the tag to reflect the actual encoding of the document, for example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
The charset
attribute on a <script>
element can be used to specify the character encoding of an external script, whose URL should be specified on the src
attribute.
If the script is not external, then the charset
attribute should not be used, as the character encoding of the HTML document will be used.
Learn more:
In HTML5 you’re encouraged to use Unicode (UTF-8) character encoding rather than a legacy character encoding such as Latin1 (Windows-1252 or ISO 8859-1).
In short, it can be just a matter of using <meta charset="utf-8"/>
in your document, but you should also ensure that your pages are also saved and served as UTF-8.
A <script>
element has been found that is using the now obsolete charset
attribute. You can safely remove this attribute.
For example, this is using both type
and charset
attributes, with their default values. Both can be removed:
<script src="app.js" type="text/javascript" charset="UTF-8"></script>
and just use this:
<script src="app.js"></script>
Learn more:
Still checking your large sites one page at a time?
Save time using our automated web checker. Let our crawler check your web pages on the W3C Validator.