Hebrew converted into jibrish while put command

HI Friends ,
I have a script which cp xml files from linux to other server thru ftp
my xml file contains charcters in hebrew
although , the command Binary exists in the script . the files contains Undefined Charcters after converting.
script :

ftp -p -n $HOST << EOF
user $USER $PASSWORD 
binary
cd /dest/files4/
put $i
EOF

PLease your Help ,
Thanks in Advanced

What's the locale settings on either side?

the source server linux UTF-8
the destination server FTP : windows-1252.

I know too little about w-1252 to say "see?", but you might need to convert the text from utf-8 to the destination locale. Try recode or iconv .
On top, I'm afraid w-1252 is not apt to represent the Hebrew language.

HI ,
thank you for your quick reply .
First of all when i'm copying the file manually , without the script . the file transfer great. you can see the hebrew in the ftp server.
the problem exists only by transfering it by the script.
I shall emphasis that the script user to work just fine .
Inside the xml file the title is encoding="utf-16"
but maybe the binary mode doesn't cover all the oppurtunity of characters, othere than that I don't see whay it stopped to conver the file successfully .
can you please donate me a little bit info about the "recode" or "iconv"
do i nedd to put it instead of binary or in addition ?
THanks in Advanced
Naama

The text file transferred fine, unless their FTP server doesn't honor the binary command. The receiver just isn't reading it right. Maybe something is wrong with the way you've set up the xml and it's not understanding what character set it should be in. Maybe it doesn't possess that character set. Or maybe the program they're using to read it just isn't capable of translating character sets at all.

reconv and iconv are external utilities you could use to change a file's character set before transmission.

1 Like

Is the entire file really UTF-16? That's not a byte-coded character set, it's completely incompatible with ANSI. It won't start <?xml, it will be spaced out into 16-bit characters i.e. < NULL ? NULL x NULL m NULL l NULL, etc. An XML processor won't even be able to understand the declspec.

Try encoding it in UTF-8 instead. That's compatible enough with ANSI that the character set declaration won't be mangled.

Hi Friends ,
So i've tried using the iconv command in order to translate my file.
I've produced 3 diffrent conversion to check which one is good .
problem : the iconv command do not convert all the file . the new files is produced with 4 rows only .
my command :

#!/bin/bash
iconv -f utf-16 -t utf-8 file1 > file2 // this file contains no rows 
iconv -f utf-16 -t windows-1252 file1 > file3  // this file contain only 4 rows 

what seems to be the problem ?
Thanks In Advanced ,
Naama

Post a hexdump of (a representative subset of) the respective files, before and after converting, and before and after ftp transfer. What's the output of the file command applied to either?

FWIW - ISO 8859-8 (Hebrew) is the ISO standard - UTF8 format. Not UTF16