title: Getting UTF-8 filenames to work with PHP ZipArchive
body: <p>I have a file that I want to add to a Zip with PHP, which is encoded in UTF-8. Here is the filename: 'µ漢字ääÖÅ.txt'.</p>
  
  <p>Now, to get this file even to save to the filesystem I had to do this:</p>
  
  <pre><code>$filename = "µ漢字ääÖÅ.txt";
  $codepage = 'Windows-' . trim(strstr(setlocale(LC_CTYPE, 0), '.'), '.');
  $encoded_filename = iconv('UTF-8', $codepage.'//IGNORE', $filename);
  file_put_contents($encoded_filename, "text");
  </code></pre>
  
  <p>Now when I want to add the file to the ziparchive I use the following code:</p>
  
  <pre><code>$zip = new \ZipArchive();
  $zip-&gt;open('test.zip', \ZIPARCHIVE::CREATE);
  $zip-&gt;addFile($encoded_filename, $encoded_filename);
  $zip-&gt;close();
  </code></pre>
  
  <p>Which results in a zip file containing the file name 'ÁõõÍ+.txt'. How do I get it to save correctly?</p>