How can i change the MySQL characters encoding to UTF8?

By default the encoding is latin1 but you could try to workaround your code.

To change the encoding in your queries, you have to add the following lines after the dbase connection line in your code:

mysql_query(mysql,"SET NAMES 'utf8'"); /* note the apostrophes: 'utf8' */
mysql_query(mysql,"SET CHARACTER SET utf8"); /* no apostrohes */

Please, for more information check the mysql manual (http://www.mysql.org).

Was this answer helpful? 1 Users Found This Useful (576 Votes)