HTML Guide for utf-8
In order to define the charset encoding of an HTML document, both of these options are valid, but only one of them must appear in the document:
<!-- This is the preferred way -->
<meta charset="UTF-8">
<!-- This is the older way, also valid -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
A <meta> tag has been found in the document stating that the charset is windows-1251, but it actually is utf-8. You should update the tag to reflect the actual encoding of the document, for example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
A <meta> tag has been found in the document stating that the charset is windows-1252, but it actually is utf-8. You should update the tag to reflect the actual encoding of the document, for example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
A character has been found in the document that is not allowed in the charset encoding being used.
The character encoding declared in the HTML differs from the actual file encoding.
The meta element with charset="utf-8" tells browsers to interpret the document as UTF-8. However, if the file is actually saved in another encoding (such as Windows-1252), validators and browsers will detect a mismatch, leading to this error. To resolve this, you must ensure the file contents and the encoding declaration match.
Recommended: Save your document in UTF-8 encoding to match your meta tag.
Alternatively, if you must use Windows-1252, update charset accordingly.
UTF-8 example (preferred):
<!DOCTYPE html>
<html lang="en">
<head>
<title>UTF-8 Encoding Example</title>
<meta charset="utf-8">
</head>
<body>
<p>This page is encoded in UTF-8.</p>
</body>
</html>
Windows-1252 example (not recommended):
<!DOCTYPE html>
<html lang="en">
<head>
<title>Windows-1252 Encoding Example</title>
<meta charset="windows-1252">
</head>
<body>
<p>This page is encoded in Windows-1252.</p>
</body>
</html>
Summary:
- Use UTF-8 as your file encoding and declare <meta charset="utf-8">.
- Always make sure the file is saved using the same encoding you declare in the HTML.
The document has been declared to use a windows-1251 charset but the actual contents seems to be utf-8. You should update the charset to that like in this example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
In HTML5 you’re encouraged to use Unicode (UTF-8) character encoding rather than a legacy character encoding such as Latin1 (Windows-1252 or ISO 8859-1).
In short, it can be just a matter of using <meta charset="utf-8"/> in your document, but you should also ensure that your pages are also saved and served as UTF-8.