开发者

mysql wrong connection encoding

I have mysql tables with utf8 encoding. The Data Backend and phpmyadmin are also set to utf8.

But something went wrong and i was told the connection was set wrong. It is easy to fix, but the Problem is, that now the whole Database is in the wrong enconding and if i fix the connection, the wrong data will be displayed in the Backend. What would be the simplest way to "convert" 开发者_如何学编程all fields of all tables? I would have written a script that runs over all tables and fields with something like utf8_decode/encode, but I would like to know if there is a nicer way?


If you have, for example, é instead of é in your DB, you could do the following

  • Export using mysqldump
  • Run a PHP script doing utf8_encode(file_get_contents('dump_file.sql')) and output it to a correctly encoded dump file
  • Import that new file using mysql

I guess that there could be smarter ways but I hope this will help.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜