0

I'm transferring all the data from a PHP + MySQL website my predecessor made, into a Flask application that I made. The MySQL database contains Chinese characters that show up as weird characters when I browse the data in PhpMyAdmin. However, they show up correctly as Chinese characters when it's retrieved from the database and rendered on the website.

So I downloaded the entire PHP project from the server, and exported the entire database in the SQL format, then ran them locally using xampp so I can experiment without making any destructive changes to the real website. Unfortunately, my locally-hosted version of the PHP website shows all Chinese characters as weird symbols like "æŽå³å£", even though I didn't change a single line of code.

My best guess is that something went wrong when I exported the database from the PhpMyAdmin server, causing the characters to be wrongly encoded. I made sure that both databases were using matching collations, which in this case is latin1_swedish_ci.

Sorry I'm new to MySQL and PhpMyAdmin, does anyone know what might have gone wrong?

Panpaper
  • 451
  • 1
  • 6
  • 16
  • Latin1 is a problem. Chinese needs `utf8mb4`. See "mojibake" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored . For further analysis, provide `SELECT HEX(...) ...` for a small amount of text, together with the expected Chinese characters. – Rick James Sep 08 '20 at 15:56
  • Which looks correct? cp932, sjis '謗蟲螢' gbk: '鎺宄澹' – Rick James Sep 08 '20 at 16:00

0 Answers0