LFTP corrupts special characters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting LFTP corrupts special characters
# 1  
Old 07-23-2012
Data 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?
# 2  
Old 07-23-2012
ASCII mode is wrong, since the file is not ASCII. Transfer the file in binary mode.
# 3  
Old 07-23-2012
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?
# 4  
Old 07-23-2012
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.
# 5  
Old 07-23-2012
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.
# 6  
Old 07-23-2012
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

lftp is not working.how to replace lftp with expect utility using same .cfg file.

We have lftp command inside shell file. which is intern calling .cfg file for transferring the file from one server to other. Below command to not working. lftp -e "set net:max-retries 1; set net:reconnect-interval-base 1; put -E -O /destinationdir/inbox/ /sourcedir/test.txt; bye" -u... (4 Replies)
Discussion started by: johnsnow
4 Replies

2. Homework & Coursework Questions

Protection and special characters

I am learning from the class how to protect the special characters and the script that I wrote here does not work when I am trying to pick up a single quote. It would complaint about parentheses problem. Please, someone could enlighten me. Thanks in advance, Scopiop Input file Hi, * ?... (2 Replies)
Discussion started by: scopiop
2 Replies

3. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

4. Shell Programming and Scripting

special characters

Hey guys, I'm trying to replace "]Facebook" from the text but sed 's/]Facebook/Johan/g' is not working could you please help me with that? (6 Replies)
Discussion started by: Johanni
6 Replies

5. UNIX for Dummies Questions & Answers

How to see special characters?

Hi all, I was wondering how can i see the special characters like \t, \n or anything else in a file by using Nano or any other linux command like less, more etc (6 Replies)
Discussion started by: gvj
6 Replies

6. UNIX for Advanced & Expert Users

lftp: Option to lftp a file, wait and download a file as soon as its created

Please let me know what is lftp options combination to wait and download a file from target as soon as its gets created. I tried with different options but not able to get it working as I need any help would be appreciated (4 Replies)
Discussion started by: bmkux
4 Replies

7. Shell Programming and Scripting

Special characters

When I open a file in vi, I see the following characters: \302\240 Can someone explain what these characters mean. Is it ASCII format? I need to trim those characters from a file. I am doing the following: tr -d '\302\240' ---------- Post updated at 08:35 PM ---------- Previous... (1 Reply)
Discussion started by: sid1982
1 Replies

8. UNIX for Dummies Questions & Answers

Using GREP for special characters

Hi folks I am issuing the following command: grep "" * Looking for the characters \/:*?"<>|#+%& within all files in a directory, but the command fails being unhappy with pipe: ksh: 0403-057 Syntax error: `|' is not expected. How do I force the command to take the pipe | ? I guess... (2 Replies)
Discussion started by: daveaasmith
2 Replies

9. UNIX for Dummies Questions & Answers

how to see special characters in a file using vi

Hi, I have a file which has special characters. I can't see them when I "vi" the file. But I am sure there are some special un seen characters. How can I see them? Please help. Thx (6 Replies)
Discussion started by: jingi1234
6 Replies

10. UNIX for Dummies Questions & Answers

special characters

I have one file which is named ^? ( the DEL character ) I'd like to know how to rename or copy the file by using its i-node number TYIA (2 Replies)
Discussion started by: nawnaw
2 Replies
Login or Register to Ask a Question