We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41444
    • 6 Posts
    I would like to know if a new solution has been found regarding the use of Arabic characters in MODX. I read a lot of posts on the subject in the forum but it doesn't look as if there would be s simple solution.

    My site is in English and Arabic. All the Arabic characters appear as "????...". As character set, I chose utf-8 and as collation "utf8-unicode-ci", but I can see in phpmyadmin that all collations for my ModX database default in "latin1_swedish_ci".



    Thank you in advance for your answer.
      • 41444
      • 6 Posts
      erratum: ..... All the Arabic characters appear as question marks....
        • 41421
        • 29 Posts
        Still no answer !? And my site has to be finished in 3 days!
        • That is a database issue. When you create the database, by default it will be whatever the server's MySQL configuration is set for (latin1_swedish_ci by default).

          You probably need to create the database using the hosting control panel, then use its database client (usually phpMyAdmin) to set the database's default collation to utf-8. The scripts MODx uses may or may not be able to override the server's default settings; again this depends on the server configuration.
            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
            • 41421
            • 29 Posts
            Thanks Susan!

            Does it mean I have to change the collation of each MODX table manually? What a work!

            For a site in ENGLISH and ARABIC what is generally recommended: utf8_general_ci or utf8_unicode_ci ?
              • 41421
              • 29 Posts
              Frankly, I do not understand. Why is MODX REVO not able the server's default settings or find another way to render Arabic characters (or similar)? I had no problem with an older version of MODX (instaled about 6 years ago.

              Is nobody using MODX REVO with Arabic?

              N:B:- Even I change the collation manually, it defaults to latin1_swedish_ci after recharging.
              • Check your /core/config/config.inc.php file, lines 9 and 12:

                ...
                $database_connection_charset = 'utf8';
                ...
                ...
                $database_dsn = 'mysql:host=localhost;dbname=modx;charset=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
                  • 41421
                  • 29 Posts
                  Both with utf8:

                  $database_type = 'mysql';
                  $database_server = 'mysql5-1';
                  $database_user = 'XXX';
                  $database_password = YYYY';
                  $database_connection_charset = 'utf8';
                  $dbase = 'XXXX';
                  $table_prefix = 'media_';
                  $database_dsn = 'mysql:host=mysql5-1;dbname=XXXX;charset=utf8';
                    • 41421
                    • 29 Posts
                    Nobody to help me out?
                    • You have to have a database with the proper default character set and collation of utf-8 and utf8_general_ci . If you don't know how to set this up, contact your hosting tech support.

                      Also make sure that in your Manager's System Settings that the modx_charset is set to UTF-8, and that you use the system setting tag in your template head:

                      charset=[[++modx_charset]]


                      http://forums.mysql.com/read.php?103,209072,209072
                        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