Archived Forum Post

Index of archived forum posts


CkFtp2 issue (bug?) - command charset

Feb 12 '16 at 14:02

I have basically this code (simplified):

CkFtp2 ftp;
ftp.put_Password(L"äëü~`€"); // a pwd with "weird" characters
ftp.connect(); // connect works
ftp.connect(); // this connect fails (wrong password)

After a lot of searching and debugging I discovered the issue: At the first connect Chilkat uses the default "ansi" encoding for the password. My ftp supports UTF-8 so chilkat automatically sets the Command Charset to "utf-8". At the second connect chilkat will send the password using the utf-8 charset and I guess that is not expected by the FTP server.

I understand why Chilkat switches to utf-8, but I think chilkat should always use ansi while connecting.


Thanks Gert,

This is a difficult problem, and I'm not sure there's a resolution other than having the app explicitly set CommandCharset before the connect. It may be that some FTP servers expect the login/password to be utf-8. If Chilkat always sent ANSI, then it would be impossible to satisfy those servers. So the solution is one of the following:

  1. Use a new instance of the CkFtp2 object for each new connection.
  2. Explicitly set the CommandCharset property = "ANSI" before calling Connect.


I agree FTP servers are weird and implementing a "fix" will break software of other customers.

I will implement a work-around for customers that need it.