Skip to main content
HTML Validation

Internal encoding declaration X disagrees with the actual encoding of the document (“utf-8”).

About This HTML Issue

A <meta> element declares a legacy encoding such as iso-8859-1, but the document is actually read as UTF-8.

A browser picks a page's character encoding by checking several sources in a fixed order. A byte order mark at the very start of the file wins, then the charset parameter of the HTTP Content-Type header, and only after those the <meta charset> or <meta http-equiv="Content-Type"> declaration inside the page. When the server sends Content-Type: text/html; charset=utf-8, the browser reads the page as UTF-8 and ignores the <meta> element. The validator reports the mismatch because the markup and the server say different things.

This usually comes from an old template or CMS theme that still carries charset=iso-8859-1 after the server and the files moved to UTF-8. The page may look fine today, but the declaration takes over whenever the header is missing, for example when the file is opened from disk or moved to a server that doesn't send a charset. The browser then decodes the UTF-8 bytes with the declared encoding, and an é turns into é.

HTML only allows UTF-8, so the fix is to declare utf-8. The shorter <meta charset="utf-8"> is equivalent to the http-equiv form. Put it first inside <head> so it falls within the first 1024 bytes of the document. The same change clears the related errors the validator reports about the charset value.

If accented characters on the page already show up as �, the file itself is saved in the legacy encoding while the server announces UTF-8. Re-save the file as UTF-8 in your editor before changing the declaration.

Invalid example

On a page served as UTF-8:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Café menu</title>
</head>

Valid example

<head>
<meta charset="utf-8">
<title>Café menu</title>
</head>

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
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries