We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10189
    • 109 Posts
    I’m using the following snippet call for a newslisting:
    [!Ditto? &parents=`20` &tpl=`news-body` &language=`svenska-utf8` &dateFormat=`%A %e %B %Y, %H:%M`!]

    In order to get swedish locale, I entered the following in config.inc.php (it was earlier in the swedish language file for Ditto, but I moved it):
    setlocale(LC_ALL, 'sv_SE.UTF-8');


    My problem is that the output looks like this:
    MÃ¥ndag 6 Augusti 2007, 14:09
    when it should look like this
    Måndag 6 Augusti 2007, 14:09
    Can anyone give me a clue as to why this happens? I’m using the proper charset
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />

    but somewhere along the way something goes wrong, the question is where.
      • 18397
      • 3,250 Posts
      It should now be fixed in the latest development version.


      Index: /trunk/assets/snippets/ditto/classes/ditto.class.inc.php
      ===================================================================
      --- /trunk/assets/snippets/ditto/classes/ditto.class.inc.php (revision 1449)
      +++ /trunk/assets/snippets/ditto/classes/ditto.class.inc.php (revision 1450)
      @@ -1001,9 +1001,5 @@
      function formatDate($dateUnixTime, $dateFormat) {
      global $modx;
      - $dt = strftime($dateFormat, (intval($dateUnixTime) + $modx->config["server_offset_time"]));
      - if ($modx->config["modx_charset"] == "UTF-8") {
      - $dt = utf8_encode($dt);
      - }
      - return $dt;
      + return strftime($dateFormat, (intval($dateUnixTime) + $modx->config["server_offset_time"]));
      }

      Index: /trunk/changelog.txt
      ===================================================================
      --- /trunk/changelog.txt (revision 1449)
      +++ /trunk/changelog.txt (revision 1450)
      @@ -486,2 +486,5 @@
      [NEW] New addFields replaces duplicate code loops with addField
      [FIXED] Bug in userSort function
      +
      +[2007-8-07: REVISION 0000]
      +[FIXED] UTF-8 dates

        • 10189
        • 109 Posts
        Odd... Upgrading Ditto completely killed the pages that calls the snippet. undecided
          • 18397
          • 3,250 Posts
          Could you please clarify "killed the pages"?
            • 10189
            • 109 Posts
            I’m just getting a blank page.
              • 18397
              • 3,250 Posts
              What revision did you download? Also, what MODx / PHP / MySQL version are you running?
                • 10189
                • 109 Posts
                Revision 1453. I’m running MODx 0.9.6, PHP 5.2.2 and MySQL 5.0.27. I’m running this locally on Mac OS X 10.4.10 (PPC G5).
                  • 18397
                  • 3,250 Posts
                  Did you update both the snippet and the files?
                    • 10189
                    • 109 Posts
                    Yes, of course. I followed the enclosed intructions very carefully.
                      • 10189
                      • 109 Posts
                      I tried to reduce the attributes in the snippet call to a minimum to see if that had any effect:

                      [!Ditto? &parents=`20` &tpl=`news-body` &language=`svenska-utf8` &dateFormat=`%A %e %B %Y, %H:%M`!]

                      was reduced to:
                      [!Ditto? &parents=`20`!]


                      This didn’t have any effect, I’m afraid.