title: PHP script for downloading files with utf-8 characters in the names
body: <p>I have files named in foreign characters, that I have uploaded after encoding the names using utf8_encode(). But now, when I m trying to download them using readfile(), they give "not found" errors.</p>
  
  <p>I have pasted the code below. I think the problem lies with some header I have defined. Can anyone tell me what's the problem?</p>
  
  <pre><code>&lt;?php
  
      ini_set('mbstring.internal_encoding','UTF-8');
      ini_set('mbstring.http_input','auto');
      ini_set('mbstring.http_output','UTF-8');
      ini_set('mbstring.detect_order','auto');
      ini_set('default_charset','UTF-8');
  
      $url = "http://filedownload.s3.amazonaws.com/cÃ©nari.txt";
      header('Content-Description: File Transfer');
      header('Content-Type: text/html; charset=UTF-8');
      header('Pragma: public');
      header('Content-Length: ' . filesize($url));
      header('Content-disposition: attachment; filename='.utf8_decode($url));
      ob_clean();
      flush();
      readfile($url);
  
  ?&gt;
  </code></pre>
  
  <p>I have also attached the file that gets downloaded on running this code.</p>
  
  <p>I m using PHP for download instead of other methods in S3 cos all these files are public and the only way I can keep them hidden is by hiding the url.</p>