i’m doing a new installation with the latest version of modx and there’s an option in the database install/setup area that i don’t remember seeing before in previous versions. just curious what to do with them.
note, i just left it default and did the check link and it says all is well. i’m just curious what one would do with these if it didn’t check out okay.
the two options in question are the "Connection Method" and the "Collation" dropdowns.
thx.
-
MODX Staff
- 10,725 Posts
These "advanced install options" are becoming a source of confusion for many and I am in the process of trying to better document and improve (i.e. automate more of) this process. Basically though, MODx now allows users to control the MySQL client connection to the database by issuing an initial query to MySQL upon connection. This query will either use SET CHARACTER SET or SET NAMES along with the charset of the collation you choose (the charset is indicated by the characters before the first _ in the collation, as these are collations, or sorting rules, of a charset) to set the MySQL client connection to use the proper character set when communicating with the database.
Confused yet? Don’t be, just select SET CHARACTER SET and make sure if you must create your database separately (rather than letting MODx create the database, which requires the database user you enter to have CREATE DATABASE privileges in MySQL), that you create it with the same character set/collation as you choose in this new setup step. If you don’t have control over the character set/collation of the database you create (or are allocated by your hosting provider) then just find out what the database is actually set to and select that in the setup.
Just be aware that if you are forced to use a character set/collation other than utf8 (some hosting providers may not provide a way to change the database character set which on historical MySQL installs has always been latin1_swedish_ci), or for some reason choose to, then you will also need to think about presenting the data in a compatible encoding for the web. This is different than the database charset/collation, but the encoding you choose in your MODx configuration settings for modx_charset (e.g. UTF-8, ISO-8859-1, cp1252, etc.) must either be compatible with the database charset/collation or you’ll need to consider using SET NAMES and utf8 to force conversion of your chosen character set to a UTF-8 compatible encoding at the MySQL client.
More on this soon to hopefully clear up other confusion but, unfortunately, it’s not a simple topic by any means. I think I’m still confused by it daily, so I always just use SET CHARACTER SET with utf8 and use UTF-8 in my modx_charset setting, making sure my database matches before I install and start populating content.
Oh, and if you use a different language file, you’ll have to make sure it matches the modx_charset setting as well.