title: json_encoded array to utf8_encoded string, write to file, file should be utf8 - php
body: <p>here my code:</p>
  
  <pre><code>$array_test = array();
  
  $array_test[0] = "test1";
  
  $array_test[1] = "test2";
  
  $array_test = json_encode($array_test);
  
  $array_test = utf8_encode($array_test);
  
  $myfile = fopen($Pfad, "w+");
  
  file_put_contents($Pfad, $neueZeile, FILE_APPEND);
  
  fclose($myfile)
  </code></pre>
  
  <p>Problem here, when I write it as this I will get an ANSI encoded file.</p>
  
  <p>As I understand the file will be UTF8 encoded if I put UTF8 encoded content into it.</p>
  
  <p>If I utf8_encode a simple string it will work, but not the whole json_encoded array.</p>
  
  <p>No I´m stucked, cause niether way it works. If I just utf8_encode the array content by itself and then json_encode it, the file will be still set as ANSI.</p>
  
  <p>Anybody some idea, is there a way, do I understand something wrong?</p>
  
  <p>I try to set the whole process of loading reading and saving to the file as utf8, but this makes it not possible for me right now.</p>
  
  <p>Thank you for reading this,
  Josef</p>