The character encoding of the HTML document was not declared

Solution 1:

Add this as a first line in the HEAD section of your HTML template

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

Solution 2:

I had the same problem with the most basic situation and my problem was solved by inserting this tag into the head of the document:

<meta charset="utf-8">

The character encoding (which is actually UTF-8) of the html document was not declared.

More on it here, and here.

Solution 3:

I had the same problem when I ran my form application in Firefox. Adding <meta charset="utf-8"/> in the html code solved my issue in Firefox.

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>Voice clip upload</title>
  <script src="voiceclip.js"></script>
</head>

<body>
  <h2>Upload Voice Clip</h2>
  <form id="upload_form" enctype="multipart/form-data" method="post">
    <input type="file" name="file1" id="file1" onchange="uploadFile()"><br>
    <progress id="progressBar" value="0" max="100" style="width:300px;"></progress>
  </form>
</body>

</html>

Solution 4:

Well when you post, the browser only outputs $title - all your HTML tags and doctype go away. You need to include those in your insert.php file:

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>insert page</title></head>
<body>
<?php 

   $title = $_POST["title"];
   $price = $_POST["price"];

  echo $title;


 ?>  
</body>
</html>

Solution 5:

You have to change the file from .html to .php.

and add this following line

header('Content-Type: text/html; charset=utf-8');