About This HTML Issue
Mismatch between the declared character encoding and the actual encoding confuses browsers and validators, and can cause character display issues.
The charset declaration in the meta tag should match the actual character encoding of your HTML file. Declaring "iso-8859-1" but saving the file as "windows-1252" (or vice versa) creates a conflict, since these encodings are similar but not identical. Moreover, UTF-8 is the recommended encoding for web documents, widely supported and preferable for modern websites.
To resolve the issue:
- Decide which character encoding your HTML file should use.
- Save your document with that encoding in your text editor or IDE.
-
Ensure your HTML declares the same encoding using the
metatag in the<head>section.
Example using UTF-8 (recommended):
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<meta charset="utf-8">
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
If you specifically want iso-8859-1:
-
Save the file as
iso-8859-1in your editor. -
Declare it in your HTML:
<!DOCTYPE html> <html lang="en"> <head> <title>ISO Example</title> <meta charset="iso-8859-1"> </head> <body> <p>Bonjour, monde !</p> </body> </html>
Make sure your editor does not save the file as windows-1252 if you declare iso-8859-1 in your HTML. For best compatibility, use UTF-8 for both saving and declaring the document encoding.
Last reviewed: May 05, 2025
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.