Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The character encoding of the HTML document was not declared

When I click to the HTML document to open it in browser the fllowing message appears: "The character encoding of the HTML document was not declared. The document will render with index.html 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. I don't know how can insert my code here

like image 570
N.A Avatar asked Jun 08 '17 02:06

N.A


3 Answers

<meta charset="UTF-8" />

Just below <head>

like image 172
Alejandro Iván Avatar answered Oct 17 '22 23:10

Alejandro Iván


Here is the HTML5 basic structure.

<!DOCTYPE html>
<html>
     <head>
        <meta charset="utf-8">
        <title>Title of the document</title>
     </head>
  <body>
    <!--The content of the document......-->
  </body>
</html> 

Note : UTF-8 is a character encoding capable of encoding all possible Unicode code point.

Here is more details about UTF-8

like image 32
Sumon Sarker Avatar answered Oct 17 '22 23:10

Sumon Sarker


If you use Atom or sublime, you can install the the very useful package called Emmet. All you have to do is enter ! , then Ctrl+E, Emmet will automatically complete the basic structure of HTML5 for you. In this case problems like something missing or a typo will not appear, and one less thing for you to worry about.

For sublime, use Ctrl+Shift+P, and install package.
For Atom, here is the GitHub address: Emmet support for Atom

like image 1
TaraLoveCats Avatar answered Oct 17 '22 23:10

TaraLoveCats