Inserting Japanese into MySQL: It almost works now...

[email protected] ("Richard Pavonarius") Mon, 14 May 2007 17:08:24 +0900
Newsgroups php.i18n
Message-ID <[email protected]>
I can get it to work by adding this:

--> $query = "SET NAMES 'utf8'";
--> $result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
$query="INSERT INTO members (username, password, name, email, gender,
country, nationality, language, dob, phone)
VALUES('$username','$password','$name','$email','$gender',$country,$nationality,$language,'$dob','$phone')";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

...but I don't want to have to SET NAMES all the time.

I made the following changes to /etc/my.cnf

[client]
default-character-set=utf8

[mysqld]
init-connect=SET NAMES 'utf8'
collation_server=utf8_unicode_ci
character_set_server=utf8
default-character-set=utf8

I can see in phpMyAdmin that the changes have been made to the system
variables, but still the only way it works is to send the SET NAMES
'utf8' query via PHP. What am I missing?

Thanks,

Rich