is not used any more and exists only for history. Post new tickets on the Github account. n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

#939 closed bug (fixed)

UTF8 support for mysql with PDO drivers does not works

Reported by: laurentj Owned by:
Priority: normal Milestone: Jelix 1.0.11
Component: jelix:db Version: 1.1.3
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:


In a mail I received from Matt Darling, here is a patch for jDbPDOConnection.class.php, line 107

      if (isset($prof['force_encoding']) && $prof['force_encoding']==true) {
          if($this->dbms == 'mysql' && isset($this->_mysqlCharsets[$GLOBALS['gJConfig']->charset])) {
              $this->exec("SET CHARACTER SET '".$this->_mysqlCharsets[$GLOBALS['gJConfig']->charset]."'");
              if('utf8' == $this->_mysqlCharsets[$GLOBALS['gJConfig']->charset]) {
                   $this->exec("SET NAMES UTF8");
          }elseif($this->dbms == 'pgsql' && isset($this->_pgsqlCharsets[$GLOBALS['gJConfig']->charset])){
              $this->exec("SET client_encoding to '".$this->_pgsqlCharsets[$GLOBALS['gJConfig']->charset]."'");

Change History (2)

comment:1 Changed 12 years ago by laurentj

  • Milestone set to Jelix 1.1.4

comment:2 Changed 12 years ago by laurentj

  • Milestone changed from Jelix 1.1.4 to Jelix 1.0.11
  • Resolution set to fixed
  • Status changed from new to closed

The patch is not really good. We just have to change SET CHARACTER to SET NAMES, like in the mysql driver of jDb.

Fixed in 1.0.x, 1.1.x and trunk.

Note: See TracTickets for help on using tickets.