title: curl, how to download files with special characters?
body: <p>my downloading function:</p>
  
  <pre><code>public static function download($a)
  {
      $curl = curl_init();
      curl_setopt($curl, CURLOPT_URL, $a);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($curl, CURLOPT_FAILONERROR, 1);
      curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($curl, CURLOPT_TIMEOUT, 15);
      $a= curl_exec($curl);
      curl_close($curl);
      return $a;
  }
  </code></pre>
  
  <p>and given this link:</p>
  
  <pre><code>http://example.com/x.txt
  </code></pre>
  
  <p>is works well. But with a special case:</p>
  
  <pre><code>http://example.com/fájl/név/with ékezetek.txt
  </code></pre>
  
  <p>then its a "<strong>400 - bad request.</strong>" <code>curl_errno</code> is 22 then. How to download it then? urlencode is not OK since it encode the hostname itself.</p>
  
  <p>EDIT: those url are given "outside", I have no influence of it!</p>