title: PHP does not write out hungarian characters from MySQL database
body: <p>So, I made a searching system test (This code searches items out of the "diakok" named database) and there is a problem with it.
  When I type in my name (Géró Kristóf) it says there are no names in the database like this, but when I write it as Gero Kristof, it finds that right (but it doesn't write out the name, because of these special letters), while there are é and ó instead of e and o in the database.
  I tried changing the encoding types also in the database and the code, but nothing works right.
  (With names which don't have special characters, it works just fine)</p>
  
  <pre><code>&lt;?php
    $keresesi_tipus = 'felhasznalonev';
    $keresesi_kifejezes = trim($_POST['keresesi_kifejezes']);
  header("Content-type: text/html; charset=utf-8");
    if (!$keresesi_kifejezes) {
      echo "Nem adott meg keresni való nevet. (1-es hibakód)";
      exit;
    }
  
    if (!get_magic_quotes_gpc()) {
      $keresesi_tipus = addslashes($keresesi_tipus);
    }
    @ $adatbazis = new mysqli('localhost', 'root', '', 'diakok');
    if (mysqli_connect_errno()) {
      echo "Hiba! Nem sikerült csatlakozni az adatbázishoz. (2-es hibakód)";
      exit;
    }
  
    $lekerdezes = "SELECT * FROM diakok WHERE ".$keresesi_tipus
                  ." LIKE '%".$keresesi_kifejezes."%'";
    $talalat = $adatbazis-&gt;query($lekerdezes);
    $talalatok_szama = $talalat-&gt;num_rows;
  
    echo "&lt;p&gt;A keresésnek megfelelő diákok száma: ".$talalatok_szama."&lt;/p&gt;";
  
    for ($i = 0; $i &lt; $talalatok_szama; $i++) {
      $sor = $talalat-&gt;fetch_assoc();
      echo "&lt;p&gt;&lt;strong&gt;".($i+1).". Teljes neve: ";
      echo htmlspecialchars(stripslashes($sor['teljes_nev']));
      echo "&lt;/strong&gt;&lt;br /&gt; Felhasználóneve: ";
      echo stripslashes($sor['felhasznalonev']);
      echo "&lt;br /&gt; Kategóriája: ";
      echo stripslashes($sor['kategoria']);
      echo "&lt;br /&gt;";
      echo "&lt;/p&gt;";
    }
    $talalat-&gt;free();
    $adatbazis-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>Here is a pic about the database: 
  <a href="https://i.stack.imgur.com/yMMBX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yMMBX.png" alt="enter image description here"></a></p>