Hi, I'm trying to get a file via FTP per FtpWebrequest - the download fails when the filename contains german Umlaute like ä,ö,ü.
Code:
FtpWebRequest request2 = (FtpWebRequest)WebRequest.Create("ftp://re-web-03.servername.de/" + "filename with ä.xls");
request2.Method = WebRequestMethods.Ftp.DownloadFile;
request2.Credentials = new NetworkCredential("xxx", "xxx");
using (FtpWebResponse response = (FtpWebResponse)request2.GetResponse()) { // <-- Exception: The remote server returned an error: (550) File unavailable ...
When changing the file name to "filename with ae.xls" it works.
The Exception is: WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
A Directory Listing via ftp works well and shows the filename:
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://re-web-03.servername.de/");
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential("xxx", "xxx");
using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
{
StreamReader sr = new StreamReader(response.GetResponseStream());
while (!sr.EndOfStream)
{ Console.WriteLine(sr.ReadLine()); } // --> output is "filename with ä.xls"
}
Output is "filename with ä.xls".
Does someone have a tip how to deal with that problem - I do not have any influence on naming that files ...
Many thanks in advance Tobi