title: Can't download file with UTF-8 characters in its name in Java
body: <p>I'm in dire need for help.
  In my android application, I'm having problem with downloading files from server contaning UTF-8 charaters in its name. With regular characters it works (english alphabet). Server receives UTF-8 characters as "?". </p>
  
  <p>Example:</p>
  
  <p>File named as "Preview-icon.png" works, but file named "Preview-iconČ.png" dosen't work, and I get "File not found error", as it searches for "Preview-icon?.png" and not "Preview-iconČ".</p>
  
  <p>I have been searching solution for a week, and I still haven't found it.</p>
  
  <p>Below is my code for downloading files:</p>
  
  <pre><code>public void downloadFile(String url, String dest_file_path) {
      try {
  
          File dest_file = new File(dest_file_path);
          URL u = new URL(url);
          URLConnection conn = u.openConnection();
          int contentLength = conn.getContentLength();
          DataInputStream stream = new DataInputStream(u.openStream());
          byte[] buffer = new byte[contentLength];
          stream.readFully(buffer);
          stream.close();
          DataOutputStream fos = new DataOutputStream(new FileOutputStream(dest_file));
          fos.write(buffer);
          fos.flush();
          fos.close();
  
      } catch(FileNotFoundException e) {
  
          Log.e("file","not found!");
          return;
      } catch (IOException e) {
          Log.e("IO","error");
          return;
      }
  </code></pre>
  
  <p>Parameter url is a regular string containing url, Eg. "<a href="http://127.0.0.1:10001/downloadfile?filepath=/home/nikola/Desktop/Preview-icon.png&amp;filename=Preview-icon.png" rel="nofollow">http://127.0.0.1:10001/downloadfile?filepath=/home/nikola/Desktop/Preview-icon.png&amp;filename=Preview-icon.png</a>". And dest_file_path is destenation of location in internal storage, Eg.  "/mnt/sdcard/Preview-icon.png".</p>