Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.8k views
in .NET FTP by (240 points)
Hello,

I am trying to send the following character:

6 Answers

0 votes
by (240 points)
Hello,

I have similar problem but with file downloading.
I use class: FTPClient
Method: Get(string localPath, string remoteFile) .

Private method from this class: GetASCII(string localPath, string remoteFile)
uses streams without encoding information:

            // create the buffered stream for writing
            StreamWriter output = new StreamWriter(localPath);
            
            // get an character input stream to read data from ... AFTER we
            // have the ok to go ahead AND AFTER we've successfully opened a
            // stream for the local file
            StreamReader input = null;
            try 
            {
                input = new StreamReader(data.DataStream);


I changed it to:

           // create the buffered stream for writing
            System.Text.Encoding encoding = System.Text.Encoding.GetEncoding(1250);
            StreamWriter output = new StreamWriter(localPath, false, encoding);
            
            // get an character input stream to read data from ... AFTER we
            // have the ok to go ahead AND AFTER we've successfully opened a
            // stream for the local file
            StreamReader input = null;
            try 
            {
                input = new StreamReader(data.DataStream, encoding);


and it work correctly.

I think the same problem is during a file uploading.
Maybe it will help....

Best regards,
Grzegorz
0 votes
by (240 points)
I can not work with local files. I have to do it in memory. When I changed it to 1250 it does not work.

Anyone an other solution for my problem???
0 votes
by (162k points)
edtFTPnet/PRO supports different encodings, but you may need to try another character encoding as it may depend on what your server supports.

Try "iso8859-1", "Windows-1252" for example.
0 votes
by (240 points)
edtFTPnet/PRO supports different encodings, but you may need to try another character encoding as it may depend on what your server supports.

Try "iso8859-1", "Windows-1252" for example.


This is my input string "2
0 votes
by (240 points)
Hi Gert,

Happy New Year!

Try codepage 437
System.Text.Encoding encoding = System.Text.Encoding.GetEncoding(437);

Please let me know if it work.

Best regards,
Grzegorz.
0 votes
by (240 points)
Hi Gert,

Happy New Year!

Try codepage 437
System.Text.Encoding encoding = System.Text.Encoding.GetEncoding(437);

Please let me know if it work.

Best regards,
Grzegorz.


Hello,

When I do the following, it works OK.
ftpPro.DataEncoding = System.Text.Encoding.GetEncoding(28591);

System.Text.Encoding encoder = System.Text.Encoding.GetEncoding(28591);
byte[] bytes = encoder.GetBytes(LocalFileContent);

ftpPro.UploadByteArray(bytes, RemoteFile, false);


All the underneath characters are retrieved correctly:

Categories

...