[CentOS] MySQL and charsets: latin1 vs. utf8

Niki Kovacs contact at kikinovak.net
Wed Jan 23 16:05:11 UTC 2008


Warren Young a écrit :
> 
> I think what you mean to ask is, can you run the mysql command line tool 
> in a different character set than the system default, so that when it 
> prints out text, it goes to the terminal with the correct character set. 
>  The answer is, yes:
> 
> $ LANG=fr_FR mysql -uDBUSER -p....

Thanks for your reply! Your suggestion solved the problem partially. 
When I create tables manually and fill them manually, french characters 
get displayed correctly. Example:

mysql> select * from pet;
+----------+---------+---------+------+------------+------------+
| name     | owner   | species | sex  | birth      | death      |
+----------+---------+---------+------+------------+------------+
| Fluffy   | Harold  | cat     | f    | 1993-02-04 | NULL       |
| Claws    | Gwen    | cat     | m    | 1994-03-17 | NULL       |
| Whistler | Gwen    | bird    | NULL | 1997-12-09 | NULL       |
| Bowser   | Diane   | dog     | m    | 1979-08-31 | 1995-07-29 |
| Bamboù   | Jérôme  | dog     | m    | 1999-01-20 | NULL       |
| Diégo    | Héloïse | cat     | m    | 1998-01-21 | NULL       |
</snip>

But when I try, for example, to restore a database from a latin1-encoded 
dumpfile, it results in a loss of all my special chars, e. g. "Hélène" 
becomes "Hlne", "Marylène" becomes "Marylne", and so on.

Any idea how this could work?



More information about the CentOS mailing list