We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38501
    • 6 Posts
    When cache is cleared or deleted front-end and admin displays well special Croatian characters.
    On the second refresh, when the resource is being loaded from the cache, the special characters are lost.
    Example:
    First load, cache cleared, resource from database: Vinarija Trdeni?
    Second load, resource from cache: Vinarija Trdeni --> (? is lost)
    (screenshot in attachement)

    In the database they are stored well, the collation is good, the charset is utf-8

    Other non-modx sites work well on the same system.
    Same site works well on local Windows 7 system with apache.

    I've filed a bug to tracker: http://tracker.modx.com/issues/7192

    System info:
    PHP version 5.3.6
    Mysql 5.5.13
    OS: Solaris, nginx, php-fpm
    • As you indicated in the tracker ticket, this appears to be an issue with your environment.
        • 38501
        • 6 Posts
        Yes, but I don't know where to look for a solution. It is so strange.
        Why is reading from database ok, but when reading from cache the problem arises?
        If i disable cache the problem still persists.

        I've updated php to 5.3.8, no luck.
        Normal php code works ok with special characters, maybe the problem is in pdo_mysql? But where?

        Update:
        In cache generated files - special characters are replaced with "\0". Could that mean something?


        [ed. note: mkash23 last edited this post 12 years, 2 months ago.]
          • 38501
          • 6 Posts
          Another thing I discovered: Cache file that is generated are ANSI encoded (not UTF-8 ). In other environments that I've tested PHP generates UTF-8 files - so this is the difference and the clue for my problem.

          Default charset in php.ini is UTF-8 so I don't know why does it generate ANSI encoded file?
            • 3749
            • 24,544 Posts
            What's the charset in core/config/config.inc.php?


            ---------------------------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
            MODX info for everyone: http://bobsguides.com/modx.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
              • 38501
              • 6 Posts
              This is database dsn:
              $database_connection_charset = 'utf8';
              $database_dsn = 'mysql:host=localhost;dbname=abcdef;charset=utf8';

              I've event try setting $driver_options
              $driver_options = array (
                PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
              );
              

              But that didn't help either.

              Every other php application works ok on that server (magento, phpmyadmin), so i think that the problem is in the PDO because, other applications don't use pdo. [ed. note: mkash23 last edited this post 12 years, 2 months ago.]
              • And are all the actual collations correct on the actual database container, tables, and columns?
                  • 38501
                  • 6 Posts
                  Yes.
                  Here are the screenshots from phpmyadmin:



                  In php.ini
                  default_charset = UTF-8

                  In my.cnf
                  [mysqld]
                  ...
                  character-set-server=utf8
                  collation-server=utf8_general_ci
                  init-connect="SET NAMES utf8"
                  
                  [mysql]
                  default-character-set=utf8
                  default-collation=utf8_general_ci
                  


                  I don't know why the first time the page loads everything is ok on screen. But when creating cache files, special characters are wrong. (Screenshot in tracker)
                    • 38501
                    • 6 Posts
                    I've finally found a workaround for my problem:
                    I've enabled cache_handler=cache.xPDOAPCCache

                    And the problem for frontend resources is solved.
                    How can i enable APC for manager?
                    I can see that mgr, system_settings still get created with xPDOFileCache.

                    In manager the problem still exists.