From: dlacroix at erasme dot org Operating system: PHP version: 5.0.4 PHP Bug Type: MySQL related Bug description: Request php.ini option to chose character_set and allow UTF8 use
Description: ------------ There is no option in php.ini to setup the character set used with the MySQL connection. I'm using PHP in UTF-8 per default, MySQL 4.1.11 in UTF-8 but when I open a connection with PHP-MySQL it use latin1. I need an option to set the character set to UTF-8 when a connection is opened like in my.cnf file for mysql client. I have written a patch for php-mysql-5.0.4. It add mysql.default_character_set variable. Like that you can set: mysql.default_character_set = utf8 I still have a problem with mysql_client_encoding function that return latin1 even if the database is well using UTF-8. But it seems to be a MySQL client problem. Without this patch PHP program like SPIP are missusing the database and thing can be double encoded in UTF-8. This patch just add the following MySQL command when a connection is opened: SET character_set_client=choosed value SET character_set_connection=choosed value SET character_set_results=choosed value Reproduce code: --------------- Patch is available here: http://index.erasme.org/php-5.0.4-mysql-characterset.patch else you can ask me ([EMAIL PROTECTED]) -- Edit bug report at http://bugs.php.net/?id=33604&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33604&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33604&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33604&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33604&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33604&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33604&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33604&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33604&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33604&r=support Expected behavior: http://bugs.php.net/fix.php?id=33604&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33604&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33604&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33604&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33604&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33604&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33604&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33604&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33604&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33604&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33604&r=mysqlcfg