Note that there are some explanatory texts on larger screens.

plurals
  1. POFtp create a filename with utf-8 chars such as greek, german etc
    primarykey
    data
    text
    <p>I am trying to create a file to an ftp server with the following code (where I also tried with UseBinary option true and false)</p> <pre><code>string username = "name"; string password = "password"; string remotefolder = "ftp://ftp.myhost.gr/public_html/test/"; string remoteFileName = "δοκιμαστικό αρχείοüß-äCopy.txt"; string localFile = @"C:\test\δοκιμαστικό αρχείο - Copy.txt"; String ftpname = "ftp://ftp.myhost.gr/public_html/test" + @"/" + Uri.EscapeUriString(Program.remoteFileName); FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpname); request.Proxy = null; request.Credentials = new NetworkCredential(username, password); request.UsePassive = true; request.KeepAlive = true; request.Method = WebRequestMethods.Ftp.UploadFile; request.UseBinary = true; //request.UseBinary = false; byte[] content = System.IO.File.ReadAllBytes(localFile); byte[] fileContents = new Byte[content.Length]; Array.Copy(content, 0, fileContents, 0, content.Length); using (Stream uploadStream = request.GetRequestStream()) { int contentLength = fileContents.Length; uploadStream.Write(fileContents, 0, contentLength); } FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Console.WriteLine(response.ExitMessage); </code></pre> <p>The problem is that file at my ftp server does not get the name I request which contains English, greek and german characters --> "δοκιμαστικό αρχείοüß-äCopy.txt</p> <p><strong>1) What can I do with that?</strong></p> <p>There is some improvement once I change my regional settings--> Current language for non-Unicode programs to Greek Language but I still miss the german chars.</p> <p><strong>2) Why does a c# program depend on this setting? Is there a special methodology i should follow in order to avoid dependency from this setting?</strong></p> <p>Encoding nightmares arose again :(</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload