PDA

View Full Version : How to convert file from one character set to another via command line?



Fli
07-02-2013, 09:31 AM
I have .sql backup file in latin1 (western european) charset

http://czyborra.com/charsets/iso8859-1.gif

and i need it to be in latin2, where it should be:

http://czyborra.com/charsets/iso8859-2.gif

i tried command iconv -f latin1 -t latin2 inputfile.sql outputfile.sql but it returns error: iconv: "illegal input sequence at position" xxx

Someone adviced using also this command: recode latin2..utf8 myfile.txt

Characters can be also replaced in file, but first backup original file cp filename filenamebackup

Linux Commands to replace particular latin1 symbols by latin2 here: http://pastebin.com/73qH1xsB

sed 's/old/new/g' input.txt > output.txt