0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

maybe there are but if I dont know them.. that does not help me ;) Your solution is better than mine I think, so thanks :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.