Skip to main content
HTML Validation

Changing character encoding “utf-8” and reparsing.

About This HTML Issue

The HTML document’s character encoding was not declared before the parser encountered non-ASCII content, forcing the validator to restart parsing with UTF-8 encoding.

When a browser or validator processes an HTML document, it needs to know the character encoding as early as possible. If the encoding isn’t declared — or is declared too late in the document — the parser may initially guess the wrong encoding and then have to restart when it detects UTF-8 content. This warning typically appears when:

  • The <meta charset="utf-8"> declaration is missing entirely.
  • The <meta charset="utf-8"> tag is placed after other elements like <title> or <script> that contain non-ASCII characters (e.g., accented letters, emoji, or special symbols).
  • The server sends a conflicting or missing Content-Type HTTP header.

The <meta charset="utf-8"> tag must appear within the first 1024 bytes of the document and should be the first child of the <head> element, before any other elements that contain text content.

Incorrect Example

<!DOCTYPE html>
<html lang="fr">
  <head>
    <title>Café résumé</title>
    <meta charset="utf-8">
  </head>
  <body>
    <p>Bienvenue au café!</p>
  </body>
</html>

Here, the <title> contains non-ASCII characters (é) before the charset declaration, triggering the reparsing warning.

Fixed Example

<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta charset="utf-8">
    <title>Café résumé</title>
  </head>
  <body>
    <p>Bienvenue au café!</p>
  </body>
</html>

Moving <meta charset="utf-8"> to the very first position inside <head> ensures the parser knows the encoding before it encounters any non-ASCII characters.

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries