[Fix] – The character encoding of the HTML document was not declared

[Fix] The character encoding of the HTML document was not declared

Are you getting the “The character encoding of the HTML document was not declared” error? 

The character encoding of the HTML document was not declared
The character encoding of the HTML document was not declared

It is quite a common error that usually occurs in Firefox when you do not specify the character encoding of the HTML document.

Firefox Error

You will receive the following error in the console if you have not declared the character encoding. The full error text you will see is,

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.

[Resolved] – The character encoding of the HTML document was not declared

To resolve this issue, there are two ways to declare the character encoding of the HTML document.

# Using meta charset

This meta tag has to be included right after the starting of the <head> tag.

<meta charset="UTF-8">

# Using meta content

Similar to the above, insert the following meta tag right after the starting of the <head> tag.

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4.5/5 - (2 votes)

One humble request ?

We are committed to delivering valuable content to the blogging community for free. We have put so much effort into writing this blog post. It'd be a great help if you consider sharing this post on social media networks.

Sharing is Caring — ❤

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *