title: How to deal with ß, ö, ä, ü etc. in an sql database?
body: <p>I have a .csv file in German language(so with characters ä,ö,ü,ß) and I upload it to an sql server;
  If I go to phpmyadmin and look at the table, these letters are shown correctly as ä,ö,ü,ß;
  However when I get an entry from the table with such a letter it doesn't work anymore and these letters are just shown with a questionmark;
  The script to upload and download is standard, so I use fopen to open the csv and then fill later the database with the value;
  Also to get it from the database is standard, namely: </p>
  
  <pre><code>$sql = "SELECT * FROM table WHERE id=$id";
  $query = mysqli_query($db, $sql);
  while ($row = mysqli_fetch_assoc($query)) {
  echo $row['name']);
  }
  </code></pre>
  
  <p>I guess it's a problem of the character encoding, however I don't know how to solve it; Anyone an idea?</p>
  
  <p>I already tried to use:</p>
  
  <pre><code>$name[$i]= str_ireplace ( 'ß' , '&amp;szlig;' , $name[$i] ); 
  </code></pre>
  
  <p>before uploading it to the database(the ß code in html) but however, the ß will not be overwritten and are still written as ß in the sql database if I upload it and look in phpmyadmin
  If I use the command:</p>
  
  <pre><code>$name[$i]= str_ireplace ( 'a' , '&amp;szlig;' , $name[$i] ); 
  </code></pre>
  
  <p>as an example, it works and all a are replace by &szlig; and will be also displayed as &szlig; in phpmyadmin;
  But with ß it doesn't work; Anyone have some idea? :) Thank you very much!! :)</p>
  
  <p>I don't know how to include the:</p>
  
  <pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  </code></pre>
  
  <p>in my script so I did it with:</p>
  
  <p>echo '';</p>
  
  <p>Is that correct? But it didn't work unfortunately; However I tried this:</p>
  
  <pre><code>$test = utf8_encode ( $row['name'] );
  echo $test;
  </code></pre>
  
  <p>and it worked; But if I get other columns having that special letters I need to write all the time:</p>
  
  <pre><code> $test1 = utf8_encode ( $row['name1'] );
   $test2 = utf8_encode ( $row['name2'] );
  </code></pre>
  
  <p>etc. Is there a possibility to set it permanently and not just for one thing?</p>