I am doing the following.
1) I am exporting a database and saving it to a file called dump.sql.
2) The file is then transferred to a different server via PHP ftp.
3) When the file has been successfully transferred the administrator has an option to run a ‘dbtransfer’ script on the new host.
4) This script blows up the script and runs the queries line by line.
This works great – however there is a problem with foreign language encoding. We are using UTF-8.
Step 1 : This works fine, file is in UTF-8 Format.
Step 3 : When I test the contents of the dump.sql file using mb_check_encoding(). The string comes back as UTF-8.
Step 4 : This creates tables with utf8_general_ci encoding. The information is dumped in.
When I check the table after the transfer I get records like this: ‘ç,Ç,ö,Ö,ü,Ü,ı,İ,ÅŸ,Åž,ÄŸ,Äž’. I don’t understand how a UTF-8 string can lose its encoding when it goes into the database. Am I missing a step? Do I need to run some sort of function to ensure the string is parsed as UTF-8?
Once the system is installed I can save foreign language queries. It is just the transfer that is messing up.
Any ideas?
Its not clear how you are doing all these steps but lets give it a shot.
Firstly, make sure all database connection settings related to character sets are set to utf-8. There are some on the database side and there are some on the client side.
Secondly, before inserting any data do the following query: