We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    Has anyone built a Hebrew language site in MODx?

    I see we have right to left support, and other right to left languages like Persian here in the forums, so I guess it will work, but would like to hear from anyone who has done so.


    thanks.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There have been a few; do a search for "hebrew" in the Google Search field above; you’ll find references to the forum posts in the second page of results.
        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
        • 30497
        • 245 Posts
        thanks sotwell. Of course, the first thing I did was search the forums for Hebrew, but the results there were pretty mixed up with code snippets and technical pages, and nothing really definitive, so I thought it worthwhile asking.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          As far as I can tell (my Hebrew is horrible and I haven’t done any sites in it yet) it’s not much different than any other language; there are a number of active rtl language users who don’t seem to be having problems once they got the database character set straightened out. The actual Hebrew users that I know of got their sites up and probably aren’t active on the forums.

          http://modxcms.com/forums/index.php/topic,12934.0.html
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Ok, now it’s my turn. I finally got a request for a site that will be in Hebrew. Here’s what I’ve got:

            The MySQL server is set to latin1. Everything else, database, tables, etc. is set to utf8, with collation of uft8_unicode_ci; the connection charset in config.inc.php is utf8. My browser is set to utf8.

            I can enter Hebrew text directly into the database via PHPMyAdmin and it is entered, extracted and displayed correctly in the front-end and in Manager fields. But when I save anything from the Manager, all Hebrew text is entered into the database as ??, even previously properly entered text via PHPMyAdmin that displayed correctly.

            I can even create a php file to insert Hebrew text into the database, using the same query MODx does, and it works fine.

            Since I can use the same browser to insert Hebrew content into the database with PHPMyAdmin, and it is displayed correctly, the issue is not the browers, the database, or PHP. Something in MODx is messing it up when saving.

            After a whole day spent getting a headache over this, It’s time to ask for help.

              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
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Just to see what would happen, I inserted some echo statements just before the insert and update queries in the save processors, and the echo came back just fine, both on the POST values and on the escaped values. Somehow the insert and update queries in MODx are not recognizing the charset settings.
                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
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Another interesting development. I changed line 96 in the dbapi.mysql.class.inc.php file from
                         @mysql_query("SET CHARACTER SET {$charset}", $this->conn);

                to
                         @mysql_query("SET NAMES {$charset}", $this->conn);

                and now it works when editing or creating documents. It still saves as ?? in all the other resources. This includes TVs; it saves as ?? from the TV tab, but editing the TV in a document saves it correctly.
                  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
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Got it fixed! This query
                  show variables like '%%character%%'

                  showed everything but the server itself set to utf8; the server was set to default to latin1. I got my hosting provider to fix that, and suddenly everything is working just fine. If anybody’s interested, I can go through just what I did to convert the latin1 database and latin1 collation sets to utf8. Actually it was pretty easy; but then this was a new installation without a lot of mixed characters yet.

                  They just changed a setting in the my.cnf file
                  character-set-server = utf8
                    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
                    • 36451
                    • 264 Posts
                    Susan, this is what I did in 0.9.6p2 to have full utf-8 support:
                    1. New variable in manager/includes/config.inc.php:
                    after line 9
                    $database_connection_charset = 'utf8';
                    insert:
                    $database_collation_connection = 'utf8_general_ci';
                    

                    2. this variable goes into in manager/index.php:
                    after line 141
                    @mysql_query("SET CHARACTER SET {$database_connection_charset}");
                    insert:
                    @mysql_query("SET SESSION collation_connection = '{$database_collation_connection}';",$modxDBConn);
                    
                      • 22303 MODX Staff
                      • 10,725 Posts
                      The only reason SET NAMES would work over SET CHARACTER SET (same thing as the SET SESSION collation_connection stuff) is if your database collation was different than the actual collation on your tables. SET CHARACTER SET automatically sets the session collation_connection to match that of the currently selected database container. Can you confirm or deny that your database collation matches the collation on your tables? If it does not match, changing the database to have the proper collation should fix your problem (if I understand what is going on correctly).