We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33983 ☆ A M B ☆
    • 181 Posts
    I have set up the _build folder for my DB tables with the scheme XML file. My question is how to you declare the character encoding in the scheme file?
      • 3749
      • 24,544 Posts
      Quote from: jgulledge at Nov 12, 2010, 07:53 PM

      I have set up the _build folder for my DB tables with the scheme XML file. My question is how to you declare the character encoding in the scheme file?

      At the top of the schema file:

      <?xml version="1.0" encoding="UTF-8"?>
        Did I help you? Buy me a beer
        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
        • 33983 ☆ A M B ☆
        • 181 Posts
        Thanks Bob - but this is just for the XML file encoding, correct? I do have this set but it is the individual Collation setting/encoding that is defaulting to latin1_swedish_ci for each column and I would like to set this to UT8_general_ci.
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: jgulledge at Nov 12, 2010, 10:19 PM

          Thanks Bob - but this is just for the XML file encoding, correct? I do have this set but it is the individual Collation setting/encoding that is defaulting to latin1_swedish_ci for each column and I would like to set this to UT8_general_ci.
          xPDO creates the tables/fields with whatever character set/collation is set on the database container you create them in.
            • 3749
            • 24,544 Posts
            Quote from: OpenGeek at Nov 12, 2010, 10:26 PM

            Quote from: jgulledge at Nov 12, 2010, 10:19 PM

            Thanks Bob - but this is just for the XML file encoding, correct? I do have this set but it is the individual Collation setting/encoding that is defaulting to latin1_swedish_ci for each column and I would like to set this to UT8_general_ci.
            xPDO creates the tables/fields with whatever character set/collation is set on the database container you create them in.

            Yes, that setting is for the XML file itself. That latin1_swedish_ci is a MySQL configuration setting. Nothing you do in the schema file will affect it.

            You can’t just change it because the data in existing tables will still be in Latin1. This might be a solution: http://bobsguides.com/convert-db-utf8.html. It converts the database, all tables, all fields in the tables, and all data in the fields to the target charset. Future tables created will then be in the new character set. It may (or may not) cause trouble, however, if the data in the DB is not all in the same character set.
              Did I help you? Buy me a beer
              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