Guilherme Longo
Guilherme Longo

Reputation: 655

converting latin1 data into utf8 inside of an existing database

I have a UTF8 mysql database and I had to import a latin1 table to it. I was hoping I could fix data errors after I had imported. Is a huge table containing all the adresses from my country. So data is been dispayed like that:

Arapiraca  A. José da Silva        Manoel Teles  57305-075  Rua
Maceió    Abelardo Pugliese        Jatiúca      57036-020  Rua 

I followed a hint saing that I should convert all TEXT fields into BLOB them convert the table to UTF8 and for the last change the BLOB fields back to TEXT.

Here is the reference: https://www.percona.com/blog/2013/10/16/utf8-data-on-latin1-tables-converting-to-utf8-without-downtime-or-double-encoding/

Now my datababase and table are UTF8 and data still displaying wrong! Is there a way to solve that?

Upvotes: 2

Views: 360

Answers (1)

White Feather
White Feather

Reputation: 2783

Following this answer:

MySQL - Convert latin1 characters on a UTF8 table into UTF8

you can make a function:

CONVERT(CAST(CONVERT(name USING latin1) AS binary) USING utf8)

and apply it.

Upvotes: 1

Related Questions