title: PHP $_POST doesn't take accents
body: <p><strong>This question is solved, check my answer to see the solution</strong></p>
  
  <hr>
  
  <p>I'm trying to add to my DB a text with accented letters through an html form that submits with POST to a PHP page, the problem is that accented letters are converted to unreadable characters.</p>
  
  <p>I have this form:</p>
  
  <pre><code>&lt;form action="page.php" method="POST"&gt;
      &lt;input type="textarea" id="text1" name="text1" /&gt;
      &lt;input type="submit" value="Send" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And then, in page.php:</p>
  
  <pre><code>echo $_POST['text1'];
  </code></pre>
  
  <p>The problem is that if i input <code>àèìòù</code> in my textarea and then i submit the form, i get this output:</p>
  
  <pre><code>Ã Ã¨Ã¬Ã²Ã¹
  </code></pre>
  
  <p>My next step would be convert accented letters to html entities with <code>htmlentities($_POST['text1']</code> but i need <code>$_POST</code> to give me the correct letters.</p>
  
  <p>Note: in the page head i already have</p>
  
  <pre><code>&lt;meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /&gt;
  </code></pre>
  
  <p>How can i fix this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried with</p>
  
  <pre><code>&lt;form action="page.php" method="POST" accept-charset="UTF-8"&gt;
      &lt;input type="textarea" id="text1" name="text1" /&gt;
      &lt;input type="submit" value="Send" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And it didn't solve it</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>Also tried with adding</p>
  
  <pre><code>&lt;meta charset='utf-8'&gt;
  </code></pre>
  
  <p>to my document's head, and it doesn't work</p>
  
  <p><strong>EDIT 3</strong></p>
  
  <p>I tried with setting my charset as UTF-8 on the second page too, and</p>
  
  <pre><code>echo $_POST['text1'];
  </code></pre>
  
  <p>displayed the correct result.</p>
  
  <p>I saw that the problem is whe i use htmlentities, with this code </p>
  
  <pre><code>echo htmlentities($_POST['text1']);
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>&amp;Atilde;&amp;nbsp;&amp;Atilde;&amp;uml;&amp;Atilde;&amp;not;&amp;Atilde;&amp;sup2;&amp;Atilde;&amp;sup1; 
  </code></pre>
  
  <p>Which actually outputs </p>
  
  <pre><code>Ã Ã¨Ã¬Ã²Ã¹ 
  </code></pre>
  
  <p>even if i set charset in my meta-tags and header too. Does anyone know how can i solve it?</p>