Rules / html rules

html.charset

Default
error
Plugin
html

A page declares the utf-8 encoding near the top.

Why: Without a declared encoding, browsers and crawlers guess, and can show text as garbled characters. The HTML spec requires the declaration within the first 1024 bytes, so this rule also fails when it comes later. The spec also requires utf-8, the encoding that every browser supports.

When off: pages without an encoding, or with a late or other encoding, pass.

<!-- ✗ Fails -->
<head>
  <title>Home</title>
</head>

<!-- ✓ Passes -->
<head>
  <meta charset="utf-8" />
  <title>Home</title>
</head>

References