Subscribe: RSS
  • Hi,
    After encountering some weirdness with a modx install that I'd upgraded from 2.2.9 to 2.2.10 I noticed that the database had two differnt character sets, Utf8-general-ci and Latin-Swedish. I decided to do a fresh install, with the result that I had a new all utf8 database, however when I install addons through package manager the character set of their tables is Latin-Swedish. Is this a problem and if so what can I do so that the packages aren't installed with a different character set to the original package?
    thanks
    Allan
    • Make sure the database itself is set to UTF-8 and so is the encoding in core/config/config.inc.php.

      SiteCheck, btw, will do extensive checks for encoding mismatches, though it won't fix them. http://bobsguides.com/sitecheck-tutorial.html.

      All that said, I have also seen extras that created tables in Latin1. I'm not sure how it happens.

      See this for a safe fix: http://bobsguides.com/convert-db-utf8.html, though if the new tables are empty, it should be safe to just change the settings in PhpMyAdmin. Be sure to change the text fields in addition to the tables.
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/MODx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • I wonder if it's possible that when someone creates a table for an extra manually then has the table converted to a schema for packaging that the charset and collation of the manually-created table is used when the package is generated?
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • The extras that I'm aware of use createObjectContainer(), which would use either the MODX charset or the DB charset -- not sure which.

          What happened in my case was that the DB charset was somehow changed back to Latin1 a while back. I suspect that it happened in a server upgrade at the host.

          Ironically, this thread prompted me to run SiteCheck again at Bob's Guides. The Quip, Dashboard, and Media Source tables were in Latin1. I just had to run my own database charset converter again on my own site. wink

          It's worth having SiteCheck around just to check this periodically. It would be really easy to fix if you caught it before any new tables were created.
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/MODx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
          • Problems like this are easily prevented by global MySQL configuration.
            cPanel example: http://forums.cpanel.net/f354/mysql-default-collation-when-account-created-whm-333621.html#post1354001

            (I know, not everyone runs its own VPS/dedicated server)
            • I find it a little difficult to understand why shared hosting providers don't configure the MySQL servers to use utf8 by default. Or why MySQL didn't start using it as the default configuration years ago.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
              • Hi,
                Thanks for he replies. Unfortunately I'm on shared hosting Eoler :-(. Bob I bought Sitecheck and ran it - which is how I realised that packages were being installed with a different character set than the db. When I look in phpMyadmin it says that the default mysql charset is Latin-swedish, Installatron must over-ride/ignore that but anything that is subsequently installed through package manager either must just pick up the default or maybe as Sottwell surmises the originally created charset is used . There are other strange things going on with the installation as well so I'm guessing that it could be something that has changed on their servers.
                Thanks
                Allan
                  • Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                  • Hi,
                    Yes it's a cpanel plan and when I look in the Operations tab it says the collation is Latin-Swedish - so it looks as though I can't use Installatron to install modx. Is it a major problem if there are two different charsets in there?
                    Thanks
                    Allan
                    • Hi Bob,
                      I'm not very bright. I'm looking at the guide to running the db conversion script:
                      See this for a safe fix: http://bobsguides.com/convert-db-utf8.html,
                      Having a little trouble following the instructions.
                      At bullet 7, where it says create a script file (in the same directory) - does that mean the same directory as ModX?
                      Thanks
                      Allan