Yesterday I started to evaluate FTP2 ActiveX for a VB6 application. We need to copy a tree to our remote server, so I am testing the methods "PutTree" and "SyncRemoteTree". I also tested the "PutFile" method. All folders and files are uploaded, but in all cases tested, if I have files with accentuation (ã, á, õ, ç, etc), the destination file is uploaded with strange characters (razões -> razÃµes).
The charset is correctly set to utf-8 using the property "DirListingCharset", and I can see it also in the logging: FEAT 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
Otherwise, if I upload the same files using Filezilla, the names stay as the original ones.
What else can I do to keep the original names of my files?
Thanks in advance for any help.
Isis Nobre Brazil
asked May 16 '13 at 10:14
The fact that õ is showing up as 2 chars (Ãµ) indicates that Chilkat correctly sent the õ using utf-8 but the server interpreted the bytes as ANSI (1-byte per char). In utf-8, õ is 2 bytes. Therefore if Chilkat sends õ in utf-8, it is sending 2 bytes for that char. If the server is interpreting the bytes as ANSI (1-byte per char), then you'll see whatever ANSI chars are represented by each of those bytes.
In summary, it seems the server really needs ANSI. Therefore, set the DirListingCharset property = "ANSI".
answered May 16 '13 at 16:55
Thank you very much for your help! I did the change and now I can send those characters correctly!
I only would like to suggest a review in the component documentation, complementing it with your expstrong textlanation above, because I read the descriptions N times and only could understand that I needed to use UTF-8 for handling these non-English characters:
PutFile(localFilePath As String, remoteFilePath As String) As Long Uploads a local file to the current directory on the FTP server.
If the remoteFilePath contains non-English characters, it may be necessary to set the DirListingCharset property equal to "utf-8". Please refer to the documentation for the DirListingCharset property.
Returns 1 for success, 0 for failure.
DirListingCharset As String Set to "ansi" by default. If the FTP server sends directory listings with non-English filenames, this property can be set to the appropriate value if necessary.
Note: This property also applies to all FTP operations where a filename or path is sent over the command channel, such as when uploading or downloadiing files. If the remote file path uses non-English characters, such as Chinese, it is likely that this property should be set to "utf-8" so that these characters are sent correctly.
answered May 21 '13 at 09:31
I'm having the same issue. I have files to ftp over with german characters in them and the german chars become unreadable after the transfer. if use the anscii they german char get deleted! from the file name, if i use the utf-8 they get replaced with scribbles. So whichever encoding I'm using it doesn't work. Filezilla can upload them without any change in the characters. Could you please advise what to try next? Regards,N0rthp0le
answered Jan 10 '14 at 10:12