title: Read FTP file with international characters
body: <p>I am downloading a FTP location file using below code. Its working for all of the files except where the file name contains international character. </p>
  
  <p>I have learned in the URI format such this is not allowed but how can download if there is existing file at mentioned location.</p>
  
  <p>For testing I have setup local FTP server under IIS like below.</p>
  
  <p><a href="http://www.online-tech-tips.com/computer-tips/setup-ftp-server-in-windows-iis/" rel="nofollow noreferrer">http://www.online-tech-tips.com/computer-tips/setup-ftp-server-in-windows-iis/</a></p>
  
  <pre><code>string mat_address = "ftp://localhost/";
  StringBuilder result = new StringBuilder();
  FtpWebRequest ftp = (FtpWebRequest)WebRequest.Create(mat_address);
  
  ftp.Credentials = new NetworkCredential("userid", "Password");
  ftp.Method = WebRequestMethods.Ftp.ListDirectory;
  
  string[] downloadfile = null;
  using (FtpWebResponse response = (FtpWebResponse)ftp.GetResponse())
  using (StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.Default, true))
  {
      downloadfile = reader.ReadToEnd().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
  }
  
  foreach (string d in downloadfile)
  {
      if (d.Contains("d"))
      {
          string temp = mat_address + HttpUtility.UrlPathEncode(d);
          FtpWebRequest ftp2 = (FtpWebRequest)WebRequest.Create(temp);
  
          ftp2.Credentials = new NetworkCredential("userid", "Password");
  
          ftp2.Method = WebRequestMethods.Ftp.GetDateTimestamp;
  
          ftp2.UseBinary = true;
  
          ftp2.Proxy = null;
          ftp2.KeepAlive = false;
          ftp2.UsePassive = false;
  
          FtpWebResponse response2 = ftp2.GetResponse() as FtpWebResponse;
          DateTime temp1 = response2.LastModified.Date;
          if (temp1 &gt; DateTime.Now.AddDays(-10))
          {
             // Some extra work
          }
      }
  }
  </code></pre>
  
  <p>I am getting error </p>
  
  <blockquote>
    <p>The remote server returned an error: (550) File unavailable (e.g., file not found, no access).</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/49GHg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/49GHg.png" alt="File unavailable error"></a></p>
  
  <p>Below is my FTP root folder with problematic file name as <code>diá.png</code></p>
  
  <p><a href="https://i.stack.imgur.com/kZLrG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kZLrG.png" alt="enter image description here"></a></p>
  
  <p>I am using C# for coding and Visual Studio 2013 for development. Whats going wrong can someone help.</p>
  
  <p><strong>Update to Question:</strong> 
  Changes in Encoding to UTF8.
  Using the local host everything works fine. But when using the FTP server from international domain like germany and sweden. The name is read like below.</p>
  
  <p>I am getting error for the line below.</p>
  
  <pre><code>FtpWebResponse response2 = ftp2.GetResponse() as FtpWebResponse;
  </code></pre>
  
  <p><strong>Hex Value for File Name:</strong>  Suggested include by Martin. Thanks
  <code>31,30,31,33,36,2D,49,43,4F,4D,20,50,4A,C4,54,54,45,52,59,44,20,70,69,63,74,20,37‌​,38,78,31,31,38,20,61,6E,6E,69,2D,76,65,72,73,61,72,69,75,73,20,5B,77,31,33,32,31‌​,20,78,20,68,39,32,31,5D,20,6D,6D,20,44,49,46,46,55,53,45,2E,50,4E,47,</code></p>