PHP & Mysql Charset question

Hey,

I need to revamp my company’s website. The database on the server uses connection collation:utf8_general_ci and Charset utf8. PHP code can retrieve the data and show on the browser without problem. But on my local machine, if I set mysqli_set_charset($link, ‘utf8’) the browser shows unreadable character for All chinese data. If I do not use mysqli_set_charset, the content shows okay. Can any one tells me why this happens please?

That’s interesting! var_dump the mysqli_get_charset give me the following output:

object(stdClass)#2 (8) { [“charset”]=> string(6) “latin1” [“collation”]=> string(17) “latin1_swedish_ci” [“comment”]=> string(20) “cp1252 West European” [“dir”]=> string(0) “” [“min_length”]=> int(1) [“max_length”]=> int(1) [“number”]=> int(8) [“state”]=> int(801) }

I’m not 100% sure but it might be if your MySQL database is already in UTF-8 it wont need to be setup to use utf8 in the PHP script. That’s just a thought i had