We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Hmm. This is a regular MIGx TV, not a MIGXdb TV? If so, those values are stored as a JSON array. It would be very interesting to see what they look like in the database. It is entirely possible that the JSON-processing functions are doing something unexpected in this case. I'm not all that familiar with multi-byte character sets and how they are handled, but I know that some PHP functions don't handle them well under all circumstances. mbstring and other oddities get involved.
      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
    • discuss.answer
      • 46950
      • 86 Posts
      Quote from: BobRay at Aug 07, 2014, 05:32 PM
      Take a look at the Tables and the individual text fields in PhpMyAdmin to make sure none of them are set to Latin1. I've had tables in MODX end up with the wrong character set when they are added by an Extra. I'm not sure what causes it.

      It may work to just reset the character set in the DB, but I would back up the DB first. If it doesn't work, restore the DB and see this: http://bobsguides.com/convert-db-utf8.html

      I would take the site off_line (change the site_status System Setting) before making any changes.
      IMO the source of the problem cannot be in the charset of the DB tables becase everything is displayed in the correct letters when I see the whole table and the fields of a line are displated with a wrong charset only when I choose a line to edit it. But anyhow thanks for the advice, I'll check the charset in phpMyAdmin.
        • 46950
        • 86 Posts
        Quote from: sottwell at Aug 07, 2014, 06:00 PM
        Hmm. This is a regular MIGx TV, not a MIGXdb TV? If so, those values are stored as a JSON array. It would be very interesting to see what they look like in the database. It is entirely possible that the JSON-processing functions are doing something unexpected in this case. I'm not all that familiar with multi-byte character sets and how they are handled, but I know that some PHP functions don't handle them well under all circumstances. mbstring and other oddities get involved.
        I believe it's the most likely explanation because, as I remember, I too did encounter with cases when one of these functions worked poorly. So I'm not sure if Bruno17 will be able to correct it sad
          • 3749
          • 24,544 Posts
          What version of PHP are you running?
            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
            • 46950
            • 86 Posts
            Quote from: BobRay at Aug 08, 2014, 05:27 PM
            What version of PHP are you running?
            I use a part of an official hosting of a firm for which I made a web-site some years ago (only php+mysql). The number of their PHP version is 5.3.18. I put phpinfo() here to be able to look at all the PHP settings: http://artinox-td.ru/modx/phpinfo.php
              • 3749
              • 24,544 Posts
              You probably want to remove that. Too much info there for hackers.

              IIRC, I read that later versions of PHP prior to 5.4 will handle multi-byte strings, but their versions of json_encode and json_decode won't. I think there are some workarounds on the web. There is also a workaround in the $modx->fromJSON and $modx->toJSON methods (though I don't know if it works perfectly), so if the MIGx code is calling json_encode and json_decode directly, that could be the problem.
                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
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                It does in one function in the main migx.class.php file. Which is probably the problem.
                    function recursive_decode($array) {
                        foreach ($array as $key => $value) {
                            if (is_string($value) && $decoded = json_decode($value, true)) {
                                $array[$key] = $this->recursive_decode($decoded);
                            } else {
                                $array[$key] = $this->recursive_decode($value);
                            }
                        }
                        return $array;
                    }
                  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
                  • 46950
                  • 86 Posts
                  Quote from: BobRay at Aug 09, 2014, 03:41 AM
                  You probably want to remove that. Too much info there for hackers.

                  Thanks, I've just deleted this file.
                    • 46950
                    • 86 Posts
                    Quote from: sottwell at Aug 09, 2014, 05:07 AM
                    It does in one function in the main migx.class.php file. Which is probably the problem.

                    Is this info for Bruno17?
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Or whoever might be able to suggest a better way to handle that recursive function. That was the only call to json_decode in the MIGx files. Otherwise, there are a lot of files with the MODX API functions. Whether or not they would have problems I don't know.
                        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