Sunday, November 20, 2011

Linux - recode tool

A great solution to deal with databases with different encodings.

This recode program has the purpose of converting files between various character sets and usages. When exact transliterations are not possible, as it is often the case, the program may get rid of the offending characters or fall back on approximations.

http://www.gnu.org/software/recode

for instance, converting one dump file with one charset to another:
cat dump_with_one_char_set.sql | recode iso-8859-1..u8 > dump_with_utf8.sql

furthermore, you'll need to edit the file in this line:
SET client_encoding = 'oldEncoding';
and change it to:
SET client_encoding = 'newEncoding';

http://blog.e-shell.org/134

No comments:

Post a Comment