November 24, 2024, 12:10:00 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Trouble with iconv command in Linux  (Read 10997 times)

Offline peddi888

  • New Member
  • Posts: 3
Trouble with iconv command in Linux
« on: September 20, 2012, 02:47:52 PM »
Hi Guys


I have used the iconv for Japan and Russia files to convert form their Source encoding to UTF-8 as the tool I'm using requires Files to be in UTF-8. The below script worked well in Unix Server[SunOS  5.10 Generic_147440-09 sun4u sparc SUNW,Sun-Fire-V440].

if [ $file_name = 'PRIEMP_JPNTXT' ]; then
mv $file1 UTF8_JPN.csv;
iconv -f SJIS -t UTF-8 UTF8_JPN.csv > $file1;
echo "$file_name Conversion done"
fi

if [ $file_name = 'PRIEMP_RUSTXT' ]; then
mv $file1 UTF8_RUS.csv;
iconv -f UCS-2LE -t UTF-8 UTF8_RUS.csv > $file1;
echo "$file_name Conversion done"
fi



Recently I have migrated my scripts from Unix machine to Linux server as per Client requirments. Linux Version is
Linux  2.6.18-308.1.1.el5 #1 SMP Fri Feb 17 16:51:01 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux Server release 5.8 (Tikanga)

After migration is done to Linux, iconv command is not working as expected. iconv is not converting the files into UTF-8. Not sure what needs to be done. Searched in many forums but not found appropriate answers. Any help on this is greatly appreciated.

iconv is present in Linux and I have checked it for particular encoding too.

-bash-3.2$ iconv -l | grep UCS
10646-1:1993/UCS4/
CSUCS4//
ISO-10646/UCS2/
ISO-10646/UCS4/
UCS-2//
UCS-2BE//
UCS-2LE//
UCS-4//
UCS-4BE//
UCS-4LE//
UCS2//
UCS4//


-bash-3.2$ iconv -l | grep SJIS
SJIS-OPEN//
SJIS-WIN//
SJIS//

Can anyone please help?