Re: hi, about package DB

From: Date: Mon, 19 Jun 2006 07:05:40 +0000
Subject: Re: hi, about package DB
References: 1  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-3822@lists.php.net to get a copy of this message
Raphaël Gertz wrote:
Hi, I reported a bug agains : http://pear.php.net/package/DB Bug url : http://pear.php.net/bugs/bug.php?id=7857 Fix this whould alow people to use mysqli connexion in utf-8 mode (whithout dirty hack on the db object) May you plz commit the change ? I know that it's suppressed by MDB2, but I haven't the time yet to check my code with MDB2 (which should need the same feature add) Summary of the patch : - Set the utf-8 mode of the connexion else issue a non fatal error - This works only if remote mysql version is 5 with utf-8 mode - This is not enabled by default, you need to add ?charset=utf-8 in the dsn string... I ask you that because mandriva cooker will be freezed in few month and my production system will use it (and I whould prefer avoid dirty hack for 1year...) I say that too because utf-8 tend to becomes a standard in fact...
But its not my decision to put in new features. Anyways since the function you use was added in 5.1 you should probably do something like the following code taken from MDB2
        if (function_exists('mysqli_set_charset')) {
            $result = @mysqli_set_charset($connection, $charset);
        } else {
            $query = 'SET character_set_client = '.$this->quote($charset, 'text');
            $result = @mysqli_query($query, $connection);
        }
regards, Lukas

« previous php.pear.qa (#3822) next »