Re: [PHP-DB] Where does the mysqli extension find the default connection charset?

2007-05-03 Thread Jean-Noël Rivasseau

Hello and thanks for your help,

However, my question was: *how* is it package dependent? You said that it
uses libmysql. In this case, which file controls the configuration of
libmysql? Or is it at compilation time that the choice is made?

I know that to be of the safe side, I should explicitly set the character
set.

Jean-Noel



On 5/2/07, Georg Richter <[EMAIL PROTECTED]> wrote:


Jean-Noël Rivasseau wrote:
> 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.

mysqli (and also mysql) extension uses the default character set for
libmysql  This can be package dependend: Several distros deliver utf8 as
default, others latin1.

To be on the safe side, you should call mysqli_set_charset($link,
"utf8/latin1/whatever) to set the character set for each connection.

/Georg
--
Georg Richter, Development Manager - Connectors & Client Connectivity
MySQL GmbH, Radlkoferstr. 2, D-81373 München, www.mysql.com
Geschäftsführer: Hans von Bell, Kaj Arnö - HRB München 162140



[PHP-DB] Where does the mysqli extension find the default connection charset?

2007-05-02 Thread Jean-Noël Rivasseau

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