title: utf 8 - PHP and MySQLi UTF8
body: <p>my table char set is utf8 and it's collation is utf8.now i have this code:</p>
  
  <pre><code>   $mysqli = new mysqli("localhost", "root", "", "Amoozeshgah");
  
              if (mysqli_connect_errno()) {
                    printf("Connect failed: %s\n", mysqli_connect_error());
  
              }
            if (!$mysqli-&gt;set_charset("utf8")) {
      printf("Error loading character set utf8: %s\n", $mysqli-&gt;error);
  } else {
      printf("Current character set: %s\n", $mysqli-&gt;character_set_name());
  }
          mysql_set_charset('utf8');
              if ($stmt = $mysqli-&gt;prepare("SELECT About_Title FROM Tbl_About WHERE About_Id=?")) {
                  $city = 8;
  
                 /* bind parameters for markers */
                  $stmt-&gt;bind_param("s", $city);
  
                /* execute query */
                  $stmt-&gt;execute();
  
                 /* bind result variables */
  
                    $result = $stmt-&gt;get_result();
  
               /* fetch value */
              while ($myrow = $result-&gt;fetch_assoc()) {
  
          // use your $myrow array as you would with any other fetch
          printf("%s is in district %s\n", $city, $myrow['About_Title']);
          print("shod");
  
      }
  </code></pre>
  
  <p>but out put is:</p>
  
  <pre><code>Current character set: utf8 8 is in district Ù†ØªÙ…Ù†ØªØ´Ø³ shod
  </code></pre>
  
  <p>what can i do?
  Edit:
  i replaced:</p>
  
  <pre><code>if (!$mysqli-&gt;set_charset("utf8")) {
          printf("Error loading character set utf8: %s\n", $mysqli-&gt;error);
      } else {
          printf("Current character set: %s\n", $mysqli-&gt;character_set_name());
      }
              mysql_set_charset('utf8');
  </code></pre>
  
  <p>with </p>
  
  <pre><code>$mysqli-&gt;set_charset("utf8")
  </code></pre>
  
  <p>but no difference.</p>