Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.4k views
in .NET FTP by (260 points)
hi guys,

having an issue with put() to my server when the filenames have accented characters. I've tried changing the ControlEncoding = new System.Text.UTF8Encoding(); but it still is using Ascii I think to create the file names - so accented characters are replaced with'?'

thanks in advance :)

2 Answers

0 votes
by (51.6k points)
This depends on which extended (i.e. 8-bit) ASCII character set the server is using. Officially the FTP protocol (RFC959) only supports 7-bit ASCII characters, but most servers actually support 8-bit ASCII (so to speak). As a result, the meaning of characters 0 to 127 is well defined, but the meaning of characters 128 to 255 varies from one server to the other. One server might interpret character 193 as an accented A, whereas another might interpret is as an accented E.

By default, edtFTPnet only supports 7-bit ASCII. If it encounters a character whose code is 128 to 255 it will represent it as a question mark. The FTPConnection.CommandEncoding property allows the developer to select an 8-bit character encoding that matches that of the server. Unfortunately many servers do not state what 8-bit ASCII character set they're using, so it's often necessary to use trial and error to find out.

Some common character encodings to try are:
ftpConnection.CommandEncoding = Encoding.GetEncoding("Windows-1252");

and
ftpConnection.CommandEncoding = Encoding.GetEncoding("ISO-8859-1");


- Hans (EDT)
0 votes
by (260 points)
thanks Hans.

Categories

...