开发者

How to recover corrupted database data due to character set

I am taking up a rails application that has a MySQL database. It is a web application that has an international audience. After few days of work, I noticed that all the tables and the database itself has latin1_sweedish_ci as collation. Later, in text fields, I discovered mumble jumble like this:

It’s edu开发者_JAVA百科cational and

Obviously it is due to the wrong character set. If it were UTF-8, this would have not happen. But as this has happened, can we recover/transform this corrupted data to utf?


You could try to mysqldump the DB, pass the dump through iconv, then reload.


you can also try this... first take back up of your database... Then make one script which will fetch records one by one and perfom utf8_decode and then store it again in database... but before that change charchter set to utf8...


You could also try to convert all the columns to binary and then to UTF-8. See mysqlperformanceblog.com and dev.mysql.com for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜