title: Symfony2 - File download and 'The filename fallback must only contain ASCII characters.' error
body: <p>Using Symfony 2.5 here, users upload MS Office files into our application and download it later as needed. Now, when the file attachment contains non-ascii chars (which is quite common as we are from Czech republic) Symfony raises error 'The filename fallback must only contain ASCII characters.' </p>
  
  <p>I found many reports of this problem and discussions e.g. </p>
  
  <blockquote>
    <p><a href="https://github.com/symfony/symfony/issues/9093" rel="nofollow noreferrer">https://github.com/symfony/symfony/issues/9093</a></p>
  </blockquote>
  
  <p>... but no real solution. I know I can convert filename to ascci when making  Content-Disposition header but it changes the filename presented to user which is not nice and quite misleading for user. Is there  way how to avoid this and be able to serve former file name? Being able to download file with non-ascii chars in filename is quite common on internet so why this restriction?</p>
  
  <p>By following this <a href="https://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http">How to encode the filename parameter of Content-Disposition header in HTTP?</a> I even tried to encode filename with urlencode() but now it says the % is not allowed char :-(</p>
  
  <p><strong>Update 1:</strong>  Here is a code snippet I'm using. I'm using streaming the response to browser and headers are defined rather manualy I think.</p>
  
  <pre><code>$response = new StreamedResponse();
  $response-&gt;headers-&gt;set('Content-Type', $upload-&gt;getMimeType());
  $contentDisposition = $response-&gt;headers-&gt;makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $upload-&gt;getFilename());
  $response-&gt;headers-&gt;set('Content-Disposition', $contentDisposition);
  </code></pre>