mariadb-conv
mariadb-conv is a character set conversion utility for MariaDB.
Usage
mariadb-conv [OPTION...] [FILE...]Options
mariadb-conv supports the following options:
-f, --from=name
Specifies the encoding of the input.
-t, --to=name
Specifies the encoding of the output.
-c, --continue
Silently ignore conversion errors.
--delimiter=name
Treat the specified characters as delimiters.
By default, mariadb-conv exits whenever it encounters any conversion problems, like
the input byte sequence is not valid in the source character set;
the character cannot be converted to the target character set.
The -c option makes mariadb-conv ignore such errors and use the question mark (?) to replace bytes in bad input sequences, or unconvertible characters.
The --delimiter=... option makes mariadb-conv treat the specified characters as delimiters rather than data to convert, so the input is treated as a combination of
data chunks, which are converted according to the
-fand-toptions;delimiters, which are not converted and are copied from the input to the output as is.
Examples
Convert the file file.latin1.txt from latin1 to utf8 :
Convert the file file.latin1.txt from latin1 to utf8, reading the input data from stdin:
Using mariadb-conv in a pipe:
As a side effect, mariadb-conv can be used to list MariaDB data directories in a human readable form. Suppose you create the following tables:
This statement creates the following files in the MariaDB data directory:
It's not precisely clear which file stores which table, because MariaDB uses a special table-name-to-file-name encoding.
This command on Linux (assuming an utf-8 console) can print the table list in a readable way:
Windows users can use the following command to list the data directory in the ANSI text console:
Note:
The
-toptions assume a Western machine.The
-coption is needed to ignore conversion errors for Cyrillic and CJK characters.--delimiter=additionally needs the carriage return character.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

