I have files to ftp over to another server with german characters in the file names and the german characters become unreadable after the transfer. if I use the anscii char coding the german chars get deleted from the file name, if i use the utf-8 char coding they get replaced with 2 bit scribbles. So whichever encoding I'm using it doesn't work. with Filezilla I can upload them without any change to the accented characters. Could you please advise what to try next? Regards,N0rthp0le
This problem was solved by using a new Chilkat FTP2 v9.5.0 property named CommandCharset.
There are two key places where the FTP client and server must agree:
1) The character encoding to be used for strings sent on the control channel. (These are the commands which could include file paths.)
2) The character encoding to be used for directory listing contents, which are sent from the server to the client on a data connection.
The CommandCharset property is for #1, and the DirListingCharset property is for #2.
Usually, an FTP server will use the same charset for both -- such as utf-8 for interpreting the bytes sent on the control channel, and for sending directory listings on a data channel. Or perhaps using the ANSI charset for both. In this case, it seems the FTP server was using utf-8 for directory listings, but was expecting the ANSI (iso-8859-1) encoding on the control channel.
Hint: If a character in a filename such as "ä" appears as two garbage chars on the server-side, what it means is that Chilkat sent utf-8 (which uses 2 bytes to represent the accented char), but the server is interpreting NOT as utf-8 but as ANSI, which is a 1-byte/char encoding. It is therefore taking each of the two bytes of the utf-8 char representation and interpreting each to be a single ANSI char, which of course turns out to be two unexpected chars (often the seldom-used glyphs that look like random garbage).
Try setting the DirListingCharset property to "utf-8". Also, post the contents of the LastErrorText for the method call that does the upload. This provides a starting point in understanding everything. Please use "pre" tags to maintain readability when posting a LastErrorText.
Thank you for your answer. It doesn't work with utf-8 either. There is no error in the LastErrorText. I tried both encoding ascii and utf-8 too, makes no difference. I took out the login credentials from the sample.
ftp.Hostname = strftpserver;
ftp.Username = ""; ftp.Password = ""; ftp.Port = 21; ftp.EnableEvents = true; ftp.Passive = true; ftp.SendBufferSize = 4096;
//ftp.DirListingCharset = "ASCII";
ftp.DirListingCharset = "UTF-8"; bool success = ftp.Connect();
ChilkatLog: PutFile: DllDate: Dec 22 2010 UnlockPrefix: MICROFFTP Username: SYSTEM Component: .NET 2.0 LocalFilename: C:\inetpub\wwwroot\Supportline\_tempincidentfiles\2498445\germany_tcm6-3262ö.gif RemoteFilename: germany_tcm6-3262ö.gif IdleTimeoutMs: 60000 ReceiveTimeoutMs: 60000 ConnectTimeoutSeconds: 60 localFileSize: 1761 initialGreeting: 220 Microsoft FTP Service restartNext: 0 ModeZ: 0 BinaryMode: 1 Passive transfer mode hostAddr: 184.108.40.206 DataConnect: hostname: 220.127.116.11 port: 63992 ConnectTimeoutMs: 60000 calling ConnectSocket2 This is an IPV4 numeric address... Connect using IPV4. ipAddress: 18.104.22.168 socketHandle: 0x17c ai_addrlen: 16 ai_addr: 0200 F9F8 D553 48E4 0000 0000 0000 0000 myIP_3: 10.120.11.195 myPort_3: 1312 connect successful. SetupPassiveDataSocket: Elapsed time: 16 millisec command: STOR PutFilename: [germany_tcm6-3262ö.gif] DataConnectionReady: Elapsed time: 0 millisec StorResponse: 125 Data connection already open; Transfer starting. ReceivedIntermediateResponse: Elapsed time: 0 millisec SendBufferSize: 4096 Sending uncompressed... lastBytesSent: 6085127108438C2F296109404000003B SentData: Elapsed time: 0 millisec FinalReply: Elapsed time: 16 millisec uploadRate: 110062 cumulativeNumBytesSent: 1761 TotalTime: Elapsed time: 32 millisec Success.
I've just downloaded ChilkatDotNet2.dll again to update the old one and it made no difference.
The web application is using .net 3.5.
I'm afraid there is nothing new. the file names appear to be correct in the last error text but when it appears on the server the umlaut letter are all scribbles and it doesn't happen when i'm uploading with filezilla. i've tried ecoding UTF-8 and ASCII and still not good. here is the last error message. the upload is successful.
Last error text: strong text
ChilkatLog: PutFile: DllDate: Aug 15 2013 ChilkatVersion: 22.214.171.124 UnlockPrefix: MCRFCSFTP Username: NWB-BSPHUB:SYSTEM Architecture: Little Endian; 32-bit Language: .NET 2.0 VerboseLogging: 0 LocalFilename: C:inetpubwwwrootSupportline_tempincidentfiles2498386germany_tcm6-3262ö.gif RemoteFilename: germany_tcm6-3262ö.gif ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 4096 --ProgressMonitoring IdleTimeoutMs: 60000 ReceiveTimeoutMs: 60000 ConnectTimeoutSeconds: 60 initialGreeting: 220 Microsoft FTP Service restartNext: 0 ModeZ: 0 BinaryMode: 1 Passive transfer mode setupPassiveDataSocket3: hostAddr: 126.96.36.199 DataConnect: hostname: 188.8.131.52 port: 49946 ConnectTimeoutMs_1: 60000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. This is an IPV4 numeric address... AddrInfoList: AddrInfo: ai_flags: 4 ai_family: 2 ai_socktype: 1 ai_protocol: 0 ai_addrlen: 16 ai_canonname: (NULL) --AddrInfo --AddrInfoList Connect using IPV4. ipAddress1: 184.108.40.206 myIP_3: 10.120.11.195 myPort_3: 2542 connect successful (2) socketOptions: SO_SNDBUF: 8192 SO_RCVBUF: 8192 TCP_NODELAY: 0 --socketOptions --DataConnect --setupPassiveDataSocket3 SetupPassiveDataSocket: Elapsed time: 0 millisec command: STOR PutFilename: [germany_tcm6-3262ö.gif] DataConnectionReady: Elapsed time: 0 millisec StorResponse: 125 Data connection already open; Transfer starting. ReceivedIntermediateResponse: Elapsed time: 16 millisec SendBufferSize: 4096 Sending uncompressed... lastBytesSent: 6085127108438C2F296109404000003B SentData: Elapsed time: 0 millisec skipFinalReply: 0 FinalReply: Elapsed time: 0 millisec uploadRate: 0 cumulativeNumBytesSent: 1761 TotalTime: Elapsed time: 16 millisec Success. --PutFile --ChilkatLog
UTF8 is certainly in it but the german char in file name is still wrong. I even built a new .net 4 web application and tried the matching .net4 chilkat dll and that doesn't work either. If there was an issue with the ftp server where the files are uploaded, it would happen when i upload with filezilla as well. Any ideas are appreciated. Thank you.
here is the Feat() text:
Your file(s) have been uploaded! 211-Extended features supported: LANG EN* UTF8 AUTH TLS;TLS-C;SSL;TLS-P; PBSZ PROT C;P; CCC HOST SIZE MDTM REST STREAM 211 END