We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36591
    • 38 Posts
    I don't know why but when I type in more than 191 characters in the description field of any resource Modx 2.6.4 / 2.6.5 only saves the first 191 characters. What's the reasoning behind this when the system says that 255 are allowed?

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      255 is not the number of characters you can store. It's the number of bytes allocated for that field (minus a null byte and sometimes bytes for indexing).

      Is your character set utf8mb4? That would explain it.

      If so, changing to utf8 would fix it, but so would just changing the field in the DB to a larger VARCHAR. It doesn't hurt to go up in size, though going down can truncate your data.

      On the SSQL tab after selecting the DB in PhpMyAdmin:

      ALTER TABLE modx_site_content MODIFY description VARCHAR(some bigger number)
        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
        • 36591
        • 38 Posts
        Quote from: BobRay at Jul 16, 2018, 09:08 PM
        255 is not the number of characters you can store. It's the number of bytes allocated for that field (minus a null byte and sometimes bytes for indexing).

        Is your character set utf8mb4? That would explain it.

        If so, changing to utf8 would fix it, but so would just changing the field in the DB to a larger VARCHAR. It doesn't hurt to go up in size, though going down can truncate your data.

        On the SSQL tab after selecting the DB in PhpMyAdmin:

        ALTER TABLE modx_site_content MODIFY description VARCHAR(some bigger number)

        Thanks, BobRay. That explains everything.
        • Bob, you are somehow wrong. The field length was reduced to 191 chars to have no errors during indexing with utf8mb charset. So there is a reduction and the field description string is wrong.
            • 3749
            • 24,544 Posts
            Thanks Jako! I stand corrected.

            But wasn't the OP getting the VARCHAR length from the DB?

            In MODX 2.6.3, the DB says varchar(255) for the description field.

            FWIW, in MODX3 the description field type is 'text' so there's no length.

            Are you saying that MODX truncates it to 191 before saving? In that case, suggesting ALTER TABLE was definitely wrong.
              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 it is text now, everything is fine for that field. There are some database fields truncated from VARCHAR(255) to VARCHAR(191) in the DB (maybe only in the models) in 2.6.x. because of a possible utf8mb index on that field. If it is only in the model, the field is truncated before save by MODX.
                • 41155
                • 13 Posts
                I have the same problem with installing MODX 2.6.5. I transferred the content via Gitifyfrom an older website. In the new db the varchar(255) are only varchar(191). I have now manually changed the lengths to 255 and watch what happens. First impression: nothing bad.
                  Weitblick Internetwerkstatt, Germany
                  www.weitblick.net