title: Special characters like ñ á é í ó ú are imported as ??? in MySQL
body: <p>I have been trying to import words with special characters into MySQL via PHP INSERT command and I either get ??? for each special character or everything after it is cut off.</p>
  
  <p>I have read a lot on the Internet buy none of the solutions seems to be working.</p>
  
  <p>So currently <code>Coruña</code> from the script, inserts as <code>Coru???a</code> in SQL with the code below:</p>
  
  <pre><code>$con=mysqli_connect("localhost","user",'pass','database');
  $con-&gt;query("SET NAMES 'utf8' ");
  $con-&gt;query("SET CHARACTER SET 'utf8'");
  
   if (mysqli_connect_errno()) {
     echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
  
  mysqli_query($con,"INSERT INTO tbl_state (id, statecode, statename,country) 
    VALUES (1, 'A Coruña', 'A Coruña', 'ES')");
  
  mysqli_close($con);
  </code></pre>
  
  <p>My page encoding is <code>content="text/html; charset=utf-8"</code>.</p>
  
  <p>I have tried with <code>utf8_general_ci</code> and <code>utf8_spanish_ci</code> collation for both table and column in MySQL but no success.</p>
  
  <p>Any experts who have come to this problem, what could be wrong?</p>
  
  <p>Thank you!</p>