5.7.124. contrib::recodeÂķ
5.7.124.1. NAMEÂķ
recode.pl - Converts a database from one encoding (or multiple encodings) to UTF-8.
5.7.124.2. SYNOPSISÂķ
contrib/recode.pl [--guess [--show-failures]] [--charset=iso-8859-2]
[--overrides=file_name]
--dry-run Don't modify the database.
--charset Primary charset your data is currently in. This can be
optionally omitted if you do --guess.
--guess Try to guess the charset of the data.
--show-failures If we fail to guess, show where we failed.
--overrides Specify a file containing overrides. See --help
for more info.
--help Display detailed help.
If you aren't sure what to do, try:
contrib/recode.pl --guess --charset=cp1252
5.7.124.3. OPTIONSÂķ
- âdry-run
Donât modify the database, just print out what the conversions will be.
recode.pl will print out a Key for each item. You can use this in the overrides file, described below.
- âguess
If your database is in multiple different encodings, specify this switch and recode.pl will do its best to determine the original charset of the data. The detection is usually very reliable.
If recode.pl cannot guess the charset, it will leave the data alone, unless youâve specified âcharset.
- âcharset=charset-name
If you do not specify âguess, then your database is converted from this character set into the UTF-8.
If you have specified âguess, recode.pl will use this charset as a fallbackâwhen it cannot guess the charset of a particular piece of data, it will guess that the data is in this charset and convert it from this charset to UTF-8.
charset-name must be a charset that is known to perlâs Encode module. To see a list of available charsets, do:
perl -MEncode -e 'print join("\n", Encode->encodings(":all"))'
- âshow-failures
If âguess fails to guess a charset, print out the data it failed on.
- âoverrides=file_name
This is a way of specifying certain encodings to override the encodings of âguess. The file is a series of lines. The line should start with the Key from âdry-run, and then a space, and then the encoding youâd like to use.
This documentation undoubtedly has bugs; if you find some, please file them here.