Often MySQL will need to be forced to return results in UTF8 encoding. There are two ways to do this:
1. Run a query “SET NAMES ‘utf8’” at the start of each connection – this will force MySQL to use UTF8 for the lifetime of that connection. This is a good option if you don’t have access to the my.cnf file.2. A better option – find and edit the file my.cnf on your database server. Add the following lines to the mysqld section :
[mysqld] default-character-set=utf8 skip-character-set-client-handshakeNow if you restart MySQL, the encoding should default to UTF8.
One Response to “Force MySQL Encoding to UTF8”
Leave a Reply