Saturday, June 9, 2012

Declaration of character encoding in HTML pages ( The character encoding of the HTML document was not declared )

I did not know about this error message before.
"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 to be declared in the document or in the transfer protocol."




Place the following line of code as shown in above picture :)

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

The error message will disappear. Thanks and have a nice day!!! :)

15 comments:

jarikata said...

Thanks, it works,
Hope you dont mind if i share it in my blog..

LNK said...

please feel free to share :)

Anonymous said...

But what is the meaning of this error? can anyone explain?

Michael Gillespie said...

It basically states that you need to declare the charset that the page accepts, or it might become corrupted. Since this snippet is making the page declare the UTF-8 encoding as its character set, it will prevent the browser from assuming a different and incompatible charset. This is mostly an issue if you are using strange characters (anything outside of a US keyboard for example, like Chinese character or something). If there is no charset defined, the browser may assume something like regular ASCII, which would cause corruption if someone put a non-ASCII character into a form. It would come out on the server possibly as garbled text instead of the actual character.

LNK said...

Thanks!! MICHAEL GILLESPIE.

Anonymous said...

Thank You,

Anonymous said...

Thank you!

Anonymous said...

Thanks a lot !

Anonymous said...

Thanks

Anonymous said...

I tried this, but it did not work in Chrome. Any thoughts?

max said...

It wasn't work. I pasted the code inside the header nothing changed.

iGuru said...

Doesn't work, any FRESH ideas?

~ Ty ~

iGuru said...

Doesn't work, any FRESH ideas?

~ Ty ~

Rahul Nikam said...
This comment has been removed by the author.
Rahul Nikam said...

add this to web.config file