Page is a not externally linkable
- WebmasterWorld
-- Webmaster General
---- struggling with chinese characters, in MySQL/PHP


UserFriendly - 12:59 am on Jul 15, 2010 (gmt 0)


httpwebwitch, have you made sure to tell PHP which encoding it should be using on your database connection?

You need to make a call to the set_charset function for your MySQL driver. For instance, if you're using the MySQLi (improved) driver, then you would issue a call like this immediately after you've opened the connection resource (referred to by a variable called $db):

mysqli_set_charset('utf8', $db);

If you are using the standard MySQL driver instead, then the call would be:

mysql_set_charset('utf8', $db);

Note that you can also call these methods in the object-oriented notation:

$db->set_charset('utf8');

See the PHP documentation for this:

[php.net...]

[edited by: UserFriendly at 1:04 am (utc) on Jul 15, 2010]


Thread source:: http://www.webmasterworld.com/webmaster/4168927.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com