Where does the mysqli extension find the default connection charset?
| From: | Jean-Noël Rivasseau | Date: | Wed, 02 May 2007 14:31:35 +0000 |
| Subject: | Where does the mysqli extension find the default connection charset? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-43525@lists.php.net to get a copy of this message | ||
Hello there,
I'd like to know which configuration file or setting is used by PHP mysqli
extension to know the default charset connection to the database.
I have two boxes with MySQL 5 / PHP 5 on them. One is a Gentoo box, and on
this one by default the connection happens in UTF-8. The other server is a
Mac OS X box and it uses latin-1 by default (forcing me to switch manually).
I thought the information would be in /etc/my.cnf (in the client charset
line), but this file is on OS X and it does not work. The only thing I could
see that PHP is using is some locale settings, because on Gentoo locale
prints
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
whereas on OS X locale prints:
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL="C"
So could anyone experienced in the mysqli extension can help me so that I
can set the default charset for the connection to be utf-8 on my OS X box?
Thanks
Jean-Noël