Hi,
We're currently in the process of changing one of our web application to be fully in utf-8 encoding standard. However, I got a little problem: our php-mysql connector doesn't seems to take account the new encoding set up with SET NAMES. Here is an example:
<?php
function showVars($s)
{
$r = mysql_query("SHOW VARIABLES LIKE '%char%'",$s);
while($pResult=mysql_fetch_assoc($r))
echo "variable name: ".$pResult["Variable_name"]." value: ".$pResult["Value"]."";
}
$s = mysql_connect("localhost","root","");
showVars($s);
echo mysql_client_encoding($s)."";
mysql_query("SET NAMES 'UTF8'",$s);
showVars($s);
echo mysql_client_encoding($s)."";
?>
The answer:
variable name: character_set_client value: latin1
variable name: character_set_connection value: latin1
variable name: character_set_database value: utf8
variable name: character_set_results value: latin1
variable name: character_set_server value: utf8
variable name: character_set_system value: utf8
variable name: character_sets_dir value: /usr/share/mysql/charsets/
latin1
variable name: character_set_client value: utf8
variable name: character_set_connection value: utf8
variable name: character_set_database value: utf8
variable name: character_set_results value: utf8
variable name: character_set_server value: utf8
variable name: character_set_system value: utf8
variable name: character_sets_dir value: /usr/share/mysql/charsets/
latin1
You can see that the character_set has been put to utf-8 with the "SET NAMES" command, but the client stays in latin1.
Does someone have an idea about this problem?
System configuration:
the computer is configured with latin1
the server is fully utf-8 and run MySQL 4.1.15-Debian_1-log