login about faq

Hi There

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 question is marked "community wiki".

asked Jan 14 '14 at 10:58

N0rthp0le's gravatar image

N0rthp0le
1222


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).

link

answered Jan 30 '14 at 09:25

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

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.

link

answered Jan 17 '14 at 13:30

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Hi 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.UnlockComponent("");
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: 213.83.72.228 DataConnect: hostname: 213.83.72.228 port: 63992 ConnectTimeoutMs: 60000 calling ConnectSocket2 This is an IPV4 numeric address... Connect using IPV4. ipAddress: 213.83.72.228 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.
link

answered Jan 27 '14 at 07:10

N0rthp0le's gravatar image

N0rthp0le
1222

You are using a very old version of Chilkat. Be sure to test using the latest version.

(Jan 27 '14 at 09:04) chilkat ♦♦

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.

link

answered Jan 27 '14 at 11:22

N0rthp0le's gravatar image

N0rthp0le
1222

Try reposting the LastErrorText results since you've updated - there may be additional information in the new version.

(Jan 27 '14 at 18:37) jpbro ♦

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: 9.4.1.42 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: 213.83.72.228 DataConnect: hostname: 213.83.72.228 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: 213.83.72.228 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

link

answered Jan 28 '14 at 13:27

N0rthp0le's gravatar image

N0rthp0le
1222

Can you post the return value of calling the .Feat function when you are connected to the server? I'm curious if it lists UTF8 as a supported feature.

(Jan 28 '14 at 13:35) jpbro ♦

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

link

answered Jan 28 '14 at 13:57

N0rthp0le's gravatar image

N0rthp0le
1222

Clearly UTF-8 is supported by the server, so using DirListingCharset="utf-8" is correc as Chilkat mentioned.

My only guess is that maybe the string as you get it locally is not Unicode? The documentation DirListCharset indicates that it converts Unicode to UTF-8 when the property is "utf-8". Can you confirm that the filename that you are passing to PutFile is a Unicode string?

(Jan 28 '14 at 14:03) jpbro ♦

Also, unrelated to the actual problem, if you can post your logs and code, etc... between <pre> and </pre> tags, it will make them a bit easier to read.

(Jan 28 '14 at 14:04) jpbro ♦

You know what - I made a mistake - I thought I read that the source string needed to be unicode, but I can't find that in the documentation now, so I must have dreamed it. Maybe chilkat has some feedback as to how the conversion takes place, and what charset your source filename needs to be in before it is converted to UTF-8?

(Jan 28 '14 at 14:12) jpbro ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×131
×90
×13

Asked: Jan 14 '14 at 10:58

Seen: 2,928 times

Last updated: Jan 30 '14 at 09:25

powered by OSQA