1
4

2 回答 2

2

It does not work because you got this broken during data fetch and you are setting display encoding - it's already too late. Simply ensure correct encoding during connection by using either using proper method like mysqli_set_charset() or do query SET NAMES UTF8 just after your connect to DB

于 2013-04-07T15:13:35.553 回答
1

Depending on the method you are using to connect to the DB, you should be specifying the charset.

With PDO, you can specify the charset in PDO::__construct(), such as: charset=UTF-8

Otherwise you have mysqli::set_charset() for MySQLi, or god forbid you're still using mysql_* functions there's mysql_set_charset()

于 2013-04-07T15:17:53.837 回答