We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22244
    • 144 Posts
    I found that my character set in the database was latin and I changed this to be utf8_general_ci like I always have.

    This goes well for all the tables except a few rows in the table modx_site_content

    pagetitle
    longtitle
    description
    introtext
    content

    All of these table-rows have latin1_swedish_ci and when trying to change the character set I get the error message:
    SQL-query:
    
    ALTER TABLE `modx_site_content` CHANGE `introtext` `introtext` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
    
    MySQL retourneerde:
    #1283 - Column 'introtext' cannot be part of FULLTEXT index 


    How to change the caracter set on these table-rows?

    Next to that I see in the system settings: modx charset: UTF-8
    When ik click this value it shows: Unicode (UTF-8) - utf-8
    Does this mean all tables should actually be UTF8_unicode_ci

    Why can’t I select General UTF8 in the dropdown?
      • 3749
      • 24,544 Posts
      You can’t just change the specification of a table or field’s character set, because then it won’t match the actual data in the tables and fields.

      A number of people have reported success with this: http://bobsguides.com/convert-db-utf8.html.
        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
      • If you’re trying to change this before you have any data in them, you probably need to delete the fulltext index and recreate it again after changing the character set. It looks like the index is called content_ft_idx:

        mysql> show index from modx_site_content;
        +-------------------+------------+----------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
        | Table             | Non_unique | Key_name       | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
        +-------------------+------------+----------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
        | modx_site_content |          0 | PRIMARY        |            1 | id          | A         |           2 |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | alias          |            1 | alias       | A         |        NULL |     NULL | NULL   | YES  | BTREE      |         |
        | modx_site_content |          1 | published      |            1 | published   | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | pub_date       |            1 | pub_date    | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | unpub_date     |            1 | unpub_date  | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | parent         |            1 | parent      | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | isfolder       |            1 | isfolder    | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | template       |            1 | template    | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | menuindex      |            1 | menuindex   | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | searchable     |            1 | searchable  | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | cacheable      |            1 | cacheable   | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | hidemenu       |            1 | hidemenu    | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | class_key      |            1 | class_key   | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | context_key    |            1 | context_key | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
        | modx_site_content |          1 | content_ft_idx |            1 | pagetitle   | NULL      |        NULL |     NULL | NULL   |      | FULLTEXT   |         |
        | modx_site_content |          1 | content_ft_idx |            2 | longtitle   | NULL      |        NULL |     NULL | NULL   |      | FULLTEXT   |         |
        | modx_site_content |          1 | content_ft_idx |            3 | description | NULL      |        NULL |     NULL | NULL   |      | FULLTEXT   |         |
        | modx_site_content |          1 | content_ft_idx |            4 | introtext   | NULL      |        NULL |     NULL | NULL   | YES  | FULLTEXT   |         |
        | modx_site_content |          1 | content_ft_idx |            5 | content     | NULL      |        NULL |     NULL | NULL   | YES  | FULLTEXT   |         |
        +-------------------+------------+----------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
        19 rows in set (0.00 sec)


        I would make a full backup of your database first, then try the following:

        alter table [your prefix]site_content drop index content_ft_idx;


        Then change your character types, and when you’re ready, recreate the index:

        create fulltext index content_ft_idx on [your prefix]site_content (pagetitle, longtitle, description, introtext, content);


        I’ve never run into your exact issue before, and like Bob said you’re going to have issues if there’s already content in those rows, but this is worth a shot if you don’t.
          www.darkstardesign.com

          Are you in the Nashville area? Join us for our next MODX meetup!
          • 22244
          • 144 Posts
          Thanks, I will give it a try.. I made the backup and the site is still in development so no serious content is present.

          I will let you know on the forum how it worked out for me!
          • paulmerchant Reply #5, 13 years ago
            Quote from: TomMLS at Apr 05, 2011, 11:16 PM

            Curiosity question: What does one gain by specifying a utf-8 character set??
            versus the "default" latin character set??

            Thank you...
            Basically, UTF-8 supports a lot more characters. For example, you can even use Simplified Chinese characters in UTF-8. No such luck with Latin sets.
              Time is what keeps everything from happening all at once.