LFTP corrupts special characters

Hi,

I am trying to use lftp to mirror two directories: one on my windows pc and one on a zOS system. One file within the local directory has special characters for different languages, e.g. pou��t (czech). When I run lftp, the characters are incorrect.

I am transferring in ASCII mode, and the target charset is IBM-1047.

I have tried encoding the local file in UTF-8, and ISO-8859-1. Neither of which seem to work.

ISO-8859-1 changes pou��t to pou6mt
UTF-8 changes pou��t to pouB6C-t

I have also tried "set ftp:charset" but i am not sure which charset to use since IBM-1047 is "not supported" by lftp.

Can anyone help or point me in the right direction?

ASCII mode is wrong, since the file is not ASCII. Transfer the file in binary mode.

Thanks for the tip Corona688. I have many different files and directories that are being mirrored. Transferring in binary like you suggested keep the local formatting, but then I have to manually convert them into IBM-1047 in order for them to be readable on the server.

Do you know of any way i can auto convert them all but still use binary transfer mode?

Binary mode and auto-conversion are mutually exclusive.

According to its manual page lftp has settings for character sets like file:charset and ftp:charset, make sure both are set properly before transfer, but I'm unsure whether it will be sophisticated enough to convert properly on transfer.

Ah ok. And yea, I tried ftp:charset and file:charset with no luck seeing as IBM-1047 is not supported.

Is there any reason why all the other files in the directory transfer/convert normally in ASCII mode even though they are not ASCII files? It is only the special characters that are incorrect and only one file has them.

Also, I found that SFTP in ASCII mode transfers the file correctly. I read that SFTP does not auto-translate the file like FTP and LFTP do. If this is true, i am assuming that my problem is in how LFTP attempts to auto-translate. I may be mislead, however.

sftp never attempts to translate, yes. It just does a blind copy.

As for why other binary files translate property, you'd have to ask the people who made lftp. Certainly they shouldn't if they're transferred in ASCII mode, so lftp may be picking and choosing which get translated and which don't.

sftp is probably preferable, in the end. It transfers passwords in a secure way, while ftp sends them across the network as plaintext.