Mysql – Database convert character_set_server latin1 to utf8

magentoMySQLPHPutf-8

I am writing about a problem on the character encoding that i have on my site with Magento. In practice, the special characters do not take utf8 and gives me the classic non-coded characters: Ã.

These are the codes in my database:

character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8

My question is … the problem of encoding is caused by character_set_server latin1 string? How do I convert my database character_set_server latin1 to utf8? It can be a very simple Query?

Thanks so much

Best Answer

character_set_server is not relevant. The setting on the database is just a default for when you CREATE TABLE without specifying a DEFAULT CHARACTER SET.

You need

  • The bytes in your client to be encoded utf8.
  • The connection specifies utf8. If you are using mysqli, use mysqli_set_charset('utf8').
  • The column in the table must be CHARACTER SET utf8. Look at SHOW CREATE TABLE; if it is not explicit on the column then look at the default for the table.
  • If you are doing html output, then it needs <meta charset=UTF-8>.