title: why does my html not display special characters taken from my database
body: <p>I included this at the top of my php file:</p>
  
  <pre><code>&lt;?php
      header('Content-Type: text/html; charset=UTF-8');
  ?&gt;
  </code></pre>
  
  <p>I did this because my file.php was not displaying "á, é, í, ó, ú or ¿" in the html file or from data queried from my database.</p>
  
  <p>After I placed the 'header('Content-Type: text/html; charset=UTF-8');' line of code my html page started to understand the special characters in the html file but, data received from my database now has a black rhombus with a question mark. </p>
  
  <p>The collation my database has is "utf8_spanish_ci"</p>
  
  <p>at the html tag i tried to put lang=es but this never worked I also tried to put the meta tag inside the head tag </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=es&gt;
  &lt;head&gt;
       &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
  &lt;head&gt;
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>&lt;meta charset="utf-8"&gt;
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
  </code></pre>
  
  <p>I don't know what the problem is. When I insert data directly into the data base the special characters are there but when I insert them from my file.php they appear with random characters.</p>
  
  <p>Does anyone know why this is happening?</p>