Quote from: OpenGeek at Apr 26, 2008, 02:42 PM
[SET NAMES forces the connection charset to whatever you specify, which
will translate characters between charsets, but that process is lossy.
Instead, you should make sure you set your database container name the name of (!)
your intended character set. SET CHAR SET actually uses the value of
the database container to set the connection charset, regardless of what
character set you specify for MODx to use. If you ensure that the
database container has the proper charset for the data your are storing
in the actual tables, and that your database_connection_charset setting
in MODx either matches this, or another charset you want to translate
the data to/from when talking to the db (though the latter is not
recommended), this should work flawlessly.
I understand the principles and diffrences between the SET NAMES and SET CHAR SET. However, the problem is that the administrator of my webhosting is dumb (don’t want to call him stupid) and for some reasons doesn’t want to change the default-character-set to utf8, though the tables (there are 10 of them

) of the MySql server were encoded in utf8.
I think such difficulties should be solved by MODx. I propose to include some setting in manager/include/config.inc.php e.g.
$database_connection_method=’SET CHARACTER SET’;
in deafault
and if there will be a need, everyone can change the setting to
$database_connection_method=’SET NAMES’;
So the starting line of the config will be looking like this
/** <br />* MODx Configuration file <br />*/ <br />$database_type = ’mysql’; <br />$database_server = ’localhost’; <br />$database_user = ’root’; <br />$database_password = ’15delfinu’; <br />$database_connection_charset = ’utf8’; <br />$database_connection_method = ’SET CHARACTER SET’; <br />$dbase = ’`modx`’; <br />$table_prefix = ’modx_’; <br />error_reporting(E_ALL & ~E_NOTICE);
This setting could be used also for the choice of the MOdx installation and that is, in the
Advanced Upgrade Install (edit database config) e.g.
Connection
method: of course with the default setting SET CHARACTER SET.
If you were interested in this modification I could program and offer e.g. diffs.
Of course, I would make changes in all the necessary files.
install/instprocessor.php <br />install/sqlParser.class.php <br />manager/actions/bkmanager.static.php <br />manager/includes/extenders/dbapi.mysql.class.inc.php <br />manager/includes/veriword.php <br />manager/index.php <br />manager/media/browser/mcpuk/connectors/php/config.php <br />manager/media/ImageEditor/config.inc.php <br />manager/processors/login.processor.php