Closed (duplicate)
Project:
Drupal core
Version:
x.y.z
Component:
mysql database
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
1 Dec 2005 at 13:52 UTC
Updated:
10 Jan 2006 at 20:40 UTC
Sometimes, in half of cases - Drupal very not clearly works with mysql
http://drupal.org/node/39518
I in confusion
On other server (php5+mysql5+apache2+freebsd) where all is for the present normal - through phpmyadmin Russian letters through phpMyAdmin too are visible so
функции / процеÑÑÑ‹
It has occured after small updating php+apache+mysql thus phpMyadmin as before and now normally writes and reads the base and old Drupal tables, and Drupal began to write and read mysql through any code conversion.
Probably it is bug Drupal
Comments
Comment #1
kiev1.org commentedInteresting problem. It is connected with a case when the mysqld: utf8 and the encoding mysqlclient is not defined.
In a file database.mysql.inc has added in the end of function db_connect here such code
mysql_query (" SET NAMES utf8 ");
and all has earned!
Probably to solve it it is more correct?
Comment #2
rkerr commentedThere are a few places where the character sets could to wrong..
Check that your my.cnf has
and that the character set of your database is utf8,
also that the character set of your tables is utf8.
The thing is, PHP has its own idea of what character set to use as default for MySQL connections... as far as I know, it doesn't check the [client] section of the my.cnf file. So...
To ensure that PHP is really using utf8 for your connection to the database, you should use:
I have one site where I've patched database.mysql.inc to always execute those 2 queries in the db_connect function because I know my tables are in utf8. This problem may be better solved long-term by having something defined, maybe in settings.php that would be used as the character set for the site.
Comment #3
kiev1.org commentedThanks! Editing my.cnf (mysql5) work on FreeBSD only, and on Gentoo for some reason helps only mysql_query (" SET NAMES utf8 ");. In any case it is the most reliable recompile mysql with utf8 by default
Comment #4
Wesley Tanaka commentedsee also the patch at: http://drupal.org/node/40515
Comment #5
gregglesAs wtanaka points out, this seems like a duplicate of http://drupal.org/node/40515