Vannkorn

Full Stack Web Developer

Close

Fixed: Corrupt SQL file contains unicode characters

I needed to restore my wedding app which was fairly old (more than 4 years old ;) ). I've switched from Windows to Mac and the problem pop up.

Ads: Register now via this link to receive $100 credit from Vultr

I happened to have my backup sql file which contains Unicode characters broken. This happened when I had just bought a new version of Mamp Pro to install in my Mac. It comes with the latest PHP and a lot of exiting features!

I then re-installed my database of one project that contains Unicode characters. Unfortunately, it shows strange characters like below:

It’s a double converted character. To fix it, simply:

  1. Convert back to latin1
  2. Convert to binary
  3. Convert to utf8

So, go to the SQL tab of the phpMyAdmin, and run the following command:

alter table table_name modify field_name VARCHAR(2000) character set latin1;
alter table table_name modify field_name blob;
alter table table_name modify field_name VARCHAR(2000) character set utf8;

Then the unicode character will be back.

Leave a Reply

Your email address will not be published. Required fields are marked *