Charset declaration is missing or occurs too late in the HTML
Stay organized with collections
Save and categorize content based on your preferences.
Servers and browsers communicate with each other by sending bytes of data over the
internet. If the server doesn't specify which character encoding format it's
using when it sends an HTML file, the browser won't know what character each byte represents.
The character encoding declaration
specification solves this problem.
How the Lighthouse charset audit fails
Lighthouse
flags pages that do not specify their character encoding:
Lighthouse considers the character encoding to be declared if it finds any of the following:
A <meta charset> element in the <head> of the document that is completely
contained in the first 1024 bytes of the document
A Content-Type HTTP response header with a charset directive that matches a
valid IANA name
Add a <meta charset> element within the first 1024 bytes of your HTML document.
The element must be fully contained within the first 1024 bytes.
The best practice is to make the <meta charset> element the first element in the
<head> of your document.