We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6705
    • 79 Posts
    Is it OK to set up my MySQL database for MODx to use the UTF8 character set, or are there any special issues that I should be aware of?

    I’m about to start developing a new website using MODx 1.0*, but the MySQL package (5.0) on my server is installed by default as follows:

    Server characterset: latin1
    Db characterset: latin1
    Client characterset: latin1
    Conn. characterset: latin1


    Is it just a case of creating my MODx database as follows:

    CREATE DATABASE mysite_modx CHARACTER SET utf8 COLLATE utf8_general_ci;


    and assuming that this will correctly override the MySQL server defaults, or is there anything else that I need to be aware of?

    Thanks for any advice.


    * And congratulations on making it to the 1.0 release! cool
      Please don't PM me unless it's absolutely essential: if a technical question is worth asking, it's worth asking in public, so that others can share their experience, and so that all can learn from the answers.
      • 25663 MODX Staff
      • 12,272 Posts
      That should take care of it and is a recommended Good Thing™.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 6705
        • 79 Posts
        Quote from: rthrash at Oct 20, 2009, 06:09 AM

        That should take care of it and is a recommended Good Thing™.

        Thanks, Ryan.

        Just to double-check (I’m slowly reading through Chapter 9 of the MySQL manual), do you know whether MODx itself will then Do the Right Thing™ about explicitly specifying character sets when it connects to the server (even though the server defaults (eg, character_set_connection) are all still set to latin1)?

        (If need be, I guess I could change the server settings* to utf8 (etc), as the database server isn’t serving any other databases (at present), so this shouldn’t have any ill-effects ..but I haven’t read that page of the fine manual yet. wink)


        *aside: I’m a little surprised that my distro’s MySQL package doesn’t yet ship with UTF8 by default; despite the phenomenal progress that has been made in recent years, I guess we’re not quite free of Latin1-isms and (ugh) ASCIIisms just yet..
          Please don't PM me unless it's absolutely essential: if a technical question is worth asking, it's worth asking in public, so that others can share their experience, and so that all can learn from the answers.