views:

251

answers:

2

Hi everyone,

I'm having problems to migrate an utf8 database to another server... Each source and destination table has a "DEFAULT CHARSET=utf8".

I use mysqldump to dump data and mysql < file.sql to import but when in the source table i have "España", in the destination i get "España".

I read some guides, i used --default-character-set=latin1 to export and import, but the problem remains. I also tried a --default-character-set=utf8 to import, but the result is: "Espa", data is truncated to the first occurrence of a multibyte char.

I need help!

Thank you in advance

A: 

What is the collation of each table? Sounds to me like the 2nd table is still encoded ISO-8859-1 or similar.

Plus, what tool are you using to look at the destination data? Are you sure the connection that tool uses is UTF-8 as well?

Pekka
Here is the SHOW CREATE TABLE code:CREATE TABLE `Country` ( `id` int(10) unsigned NOT NULL auto_increment, `country` varchar(255) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8how do i get the collation ?
Dario
i use --default-character-set=utf8 to import data using mysql < file
Dario
Try DESCRIBE. -
Pekka
to look at destination data i use mysql client, and yes, i'm sure it is a utf8 connection:| character_set_client | utf8 || character_set_connection | utf8 |
Dario
Character sets and table/column collations are not the same. What collation are your tables/columns? What does DESCRIBE say? Check http://dev.mysql.com/doc/refman/5.0/en/charset.html
Pekka
A: 

try

iconv --from-code=ISO-8859-1 --to-code=UTF-8 ./file >file.utf8
mysql --default-charset=utf8 < file.utf8 

If it does not work i advise you to import data then convert it

ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

hope it'll help

Darkyo