Using Linux/UNIX shell to convert encoding of SQL database files or any text files

 

del.icio.us Tags: ,,,,

 

iconv, provided by sys-libs/glibc, is used to convert text files from one charset to another. iconv can be used to recode a sql dump even if the environment is not set to utf8.

From latin1 to utf8
$ iconv -f ISO-8859-15 -t UTF-8 file1.sql > file2.sql

From Japanese to utf8

$ iconv -f ISO2022JP -t UTF-8 file1.sql > file2.sql

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

4 + 12 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.