I have a MySQL backup file in .gz
format that was created by the backup wizard in cPanel.
When the restoration is done by the backup wizard, contents with Arabic and Kurdish characters do not show correctly, even though I changed the collation to different UTF-8 encoding in PhpMyadmin.
For example, the real data in DB is : كامپى زانكۆ and the data showed after the restoring become to this : بÙâزاÙÙÛÛâ
This is a fairly common problem caused by inconsistent encoding schemes when creating and exporting the database. Here is the simplest way to solve it:
- Import your backup file
- Export it again, but using
latin1
encoding - Manually edit the exported file, change all occurrences of
latin1
toutf8
. - Import the edited file.
I added the lines
character-set-server=utf8
collation-server=utf8_general_ci
to the mysqld section of /etc/mysql/my.cnf
on my new server, then exported the data using
mysqldump oldDB --default-character-set=latin1 -r dbCopy.sql
and imported it into the new DB using
mysql> SOURCE dbCopy.sql
. Worked like a charm...
来源:https://stackoverflow.com/questions/17756002/restore-mysql-db-with-unicode-characters-arabic-and-kurdish-in-gz-format