Edit report at http://bugs.php.net/bug.php?id=33604&edit=1
ID: 33604 Comment by: mabi at gentoo dot org Reported by: dlacroix at erasme dot org Summary: MYSQL: php.ini option to set character_set and allow using UTF8 Status: Open Type: Feature/Change Request Package: Feature/Change Request PHP Version: 5.0.4 New Comment: Just attached the patch gentoo currently ships for this. In short: it provides a mysql.connect_charset php.ini option and uses mysql_options so that each connection will have this charset set by default. We use a similar patch for mysqli. The patch is not mine (I just adapted it to work with php-5.3.3), the original credits are: Initial patch by Stuart (?) and CHTEKK Updated for 5.3 by hoffie Previous Comments: ------------------------------------------------------------------------ [2005-07-07 15:43:00] dlacroix at erasme dot org 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 (dlacr...@erasme.org) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=33604&edit=1