We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8790
    • 526 Posts
    Hi,

    I made a modx 093 site running for almost a year with 2 languages (Fr as default + English)
    The client asked us to add Russian.

    I though i was quit simple, just copy/paste the text.
    However The first attempt is very scary :

    The russian text have been translated by a professional translator and given to me, so I’m supposed to simply paste the text string at the right places.
    I can’t read Russian and actually not able to use Russian Modx forum.

    When pasting in cyrillic the doc name, long title, and a short content, as soon as I saved it all cyrilics caracters have turned to question marks (?)

    The site is using UTF8 since the beginning (defaut Francais-utf8 for the manager and charset encoding is UTF-8)

    and in the config.inc.php of the "manager/include" folder we have :
    $database_connection_charset = 'utf8';
    $database_connection_method = 'SET NAMES';


    but in the manager info page I see:
    Jeu de caractères de la BDD  (=DB charset)	   	latin1
    Collation de la BDD (=DB collation)	  	latin1_swedish_ci

    hosted by OVH.fr

    may be some clue here ?

    Really need some help

    Thank you
      Schtroumpf Grognon - Grouchy Smurf
      ---------------------------------
      Faites pas attention.. - Don't pay attention
      http://www.dzi-neo.net
      • 14197
      • 35 Posts
      This means your client site is utf8 encoding and you are connecting to your database using utf8 but your database is unfortunately latin1 encoding, so there is a mismatch. If you can try to recreate your database using utf8 encoding that would solve your problem, otherwise if your Russian version website is a separate one, you can try this solution: set your connection in manager\include\configure.php to be latin1, this cause everything utf8 to be saved in a "wrong" format but you should get a working Russian website.

        • 8790
        • 526 Posts
        hi,


        Thank you for your comments.

        Things ae getting clearer, the host (not a dedicated one) at OVH uses latin-1 as default character set encoding into the DB tables.

        It appears that MODx do not ask or mentions this fact at the beginning of an installation and create tables with default charset of the MySql host existing DB.
        If you never had to deal with incompatible charsets before, like me, well, I guess most of the time this won’t be an issue.

        However if you need suddenly to had a new "incompatible" language version of the site, this is not the same.

        So I have to
        ALTER DATABASE db_name [DEFAULT] CHARACTER SET charset_name

        to change this to utf-8 (or alter tables at least, I don’t know yet).

        I suggest, imho, the MODx installation process could display the defaut charset that will be used, mentioning the possible issues if some "exotic" charset will be used and proposes to change this to utf-8, if this not done by default.

        (and by the way I guess it could be better (?) if MODx changes DB to utf-8 as a default behaviour)

        Some cmf like Typo3 do.


        Thank you

          Schtroumpf Grognon - Grouchy Smurf
          ---------------------------------
          Faites pas attention.. - Don't pay attention
          http://www.dzi-neo.net
          • 8790
          • 526 Posts
          self-answer:

          We choose to import tables sql content from phpmyadmin (or manager backup function), and turned in the sql files for each create table declaration :
          ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='xxxxx';

          into
          ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='xxxxxx';

          (be sure to use utf8 text editor - pspad for instance )

          them reimport using phpmyadmin
          I first try this with the modx_content table only to check potential side effects, and processed the whole database when we where sure it was ok.
          Now the Cyrillic characters are stored and rendered correctly.

          Still issues with transliterateAlias, see other post.

          Thank you

          [edit]
          Without TranslierateAlias, it’s simple to modify /www/manager/processors/save_content.processor.php after line 674 where the accented characters are converted and adding an iso9 cyrillic transliteration table in the $replace_array array

          'А'=>'A','Б'=>'B','В'=>'V','Г'=>'G','Д'=>'D',
                 'Е'=>'E','Ё'=>'YO','Ж'=>'ZH',
                 'З'=>'Z','И'=>'I','Й'=>'J','К'=>'K','Л'=>'L',
                 'М'=>'M','Н'=>'N','О'=>'O','П'=>'P','Р'=>'R',
                 'С'=>'S','Т'=>'T','У'=>'U','Ф'=>'F','Х'=>'X',
                 'Ц'=>'C','Ч'=>'CH','Ш'=>'SH','Щ'=>'SHH','Ъ'=>"'",
                 'Ы'=>'Y','Ь'=>'','Э'=>'E','Ю'=>'YU','Я'=>'YA',
                 'а'=>'a','б'=>'b','в'=>'v','г'=>'g','д'=>'d',
                 'е'=>'e','ё'=>'yo','ж'=>'zh',
                 'з'=>'z','и'=>'i','й'=>'j','к'=>'k','л'=>'l',
                 'м'=>'m','н'=>'n','о'=>'o','п'=>'p','р'=>'r',
                 'с'=>'s','т'=>'t','у'=>'u','ф'=>'f','х'=>'x',
                 'ц'=>'c','ч'=>'ch','ш'=>'sh','щ'=>'shh','ъ'=>'',
                 'ы'=>'y','ь'=>'','э'=>'e','ю'=>'yu','я'=>'ya',

            Schtroumpf Grognon - Grouchy Smurf
            ---------------------------------
            Faites pas attention.. - Don't pay attention
            http://www.dzi-neo.net