On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hello from Czech Republic,
    last week I get through installation of MODx CMS, but now I have trouble "how correctly setup language of CMS".

    What I mean:
    - my MySQL database modx has character set = cp1250 (I can’t change it because it’s hosting DB)
    - in administration of MODx I set character encoding = utf-8 and site name = "ěščřžýáíé" (to test czech letters)
    - in my template I wrote "<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />"

    And result is
    - in administration is shown bad sitename = "ě????????????????"
    - on front page is shown bad sitename = "ě????????????????"

    Same problem I solved in past with other CMS (PostNuke, Xaraya, ... etc) by calling SQL statements after CMS connected to DB:

    SET NAMES ’utf8’;
    SET character_set_results = utf8;
    SET collation_connection = @@collation_database;

    So I tried append lines to dbapi.mysql.class.inc.php - function connect()

    @mysql_query("SET NAMES ’utf8’;", $this->conn);
    @mysql_query("SET character_set_results = utf8;", $this->conn);
    @mysql_query("SET collation_connection = @@collation_database;", $this->conn);

    or

    $this->db->query("SET NAMES ’utf8’;");
    $this->db->query("SET character_set_results = utf8;");
    $this->db->query("SET collation_connection = @@collation_database;");

    but it doesn’t work for me ... sad

    If I tried manually change file \modx\assets\cache\siteCache.idx.php
    $c[’site_name’] = "ěščřžýáíé";
    then it works, but if I change in Administration >> System configuration >>
    Site name = "ěščřžýáíé";
    and save it, then in siteCache.idx.php is wrong line again
    $c[’site_name’] = "ě????????????";

    Please could you help me how to solve it?? huh

    Thank you budha
    • Use utf-8.

      first edit the ./manager/index.php
      // connect to the database
      if(@!$modxDBConn = mysql_connect($database_server, $database_user, $database_password)) {
              die("<h2>Failed to create the database connection!</h2>. Please run the MODx <a href='../install'>install utility</a>");
      } else {
              mysql_select_db($dbase);
              MYSQL_QUERY('SET NAMES utf8');
              MYSQL_QUERY('SET CHARACTER SET utf8');
      }
      


      • do it also in dbapi.mysql.class.inc.php - function connect();
      • in site settings select codepage utf-8
      • in your template(s), in header must be this line <meta http-equiv="Content-Type" content="text/html; charset=[(etomite_charset)]" />
      • and mysql database tables must be in utf8 (may’be not important)

      let’me know after you comlete. nuker [at] perm [dot] ru

      PS: are you speak russian?
      • Oh’NO! It’s again trouble with encodings! May’be it’s mysql configuration.
        If i Edit page title in QEdit then it’s correct saved and displayed, if i use manager, then get huh?? again.
        Before my fix is worked properly, while i not restarted mysql.
        let me know if you solve this problem
        • This is work for me
          MYSQL_QUERY(’SET NAMES utf8’,$modxDBConn);
          MYSQL_QUERY(’SET CHARACTER SET utf8’,$modxDBConn);
          MYSQL_QUERY("SET SESSION collation_connection = ’utf8_general_ci’",$modxDBConn);