It is done correctly, and exactly as designed. If you let MODx create the database container it creates it with the correct collation and the tables get the same. If you create it manually, you are responsible for making sure the collation matches what you want the tables to get, and they will always match the database container. If we forced them to utf8_general_ci, no one would be able to use them with another charset or collation. It just takes a little diligence to make sure you database is not created with MySQL’s wonderful default, latin1_swedish_ci.
Our developers looked into it some more, it seems that when installing MODx with the installer, you can choose the character set encoding, and it’s set correctly in the $database_connection_charset variable in the config.php, but the creation of the tables themselves don’t force the chosen collation on the tables, and thus they are always the default mySQL collation (latin1_swedish_ci’). So it seems in the installation script the table create statements have to be extended with a character_set and collation setting (http://dev.mysql.com/doc/refman/5.0/en/charset-table.html). If this is done correctly the MODx tables will have a correct UTF8 collation, the config.php setting will also be corresponding to UTF8 and thus everything will work ok.
Quote from: olafmol at Feb 11, 2009, 02:04 PMIt is done correctly, and exactly as designed. If you let MODx create the database container it creates it with the correct collation and the tables get the same. If you create it manually, you are responsible for making sure the collation matches what you want the tables to get, and they will always match the database container. If we forced them to utf8_general_ci, no one would be able to use them with another charset or collation. It just takes a little diligence to make sure you database is not created with MySQL’s wonderful default, latin1_swedish_ci.
Our developers looked into it some more, it seems that when installing MODx with the installer, you can choose the character set encoding, and it’s set correctly in the $database_connection_charset variable in the config.php, but the creation of the tables themselves don’t force the chosen collation on the tables, and thus they are always the default mySQL collation (latin1_swedish_ci’). So it seems in the installation script the table create statements have to be extended with a character_set and collation setting (http://dev.mysql.com/doc/refman/5.0/en/charset-table.html). If this is done correctly the MODx tables will have a correct UTF8 collation, the config.php setting will also be corresponding to UTF8 and thus everything will work ok.
you’re right about the installation, i will fire our developer
Was having this issue myself today, although phpMyAdmin says that the collation _is_ utf8_collation
Tried following the instructions here - http://hexmen.com/blog/2008/07/mysql-latin1-utf8-wordpress-upgrade/ and exported/ imported to another db name for testing, and amended modx to use the new db. That seemed to work for 961, but in .963 I just get garbage out.
If I go back to 961 its ok.
Before I did the export to another db, adding connection_charset=’utf8’ would give me garbage results (utf8 mangled to death).
After exporting the db to another DB I can use this and its ok:
$database_connection_charset = ’utf8’;
$database_connection_method = ’SET NAMES’;
..but only in 961
However 0.963 returns to show garbage, even if comment out the connection_method.
Any idea’s?
I know its *got* to be encoding related, but i’m at a loss to see where. phpMyAdmin claims its all utf8, etc!
$database_connection_method = 'SET CHARACTER SET';