Rolled back alleged invalid UTF sequence fix.

This commit is contained in:
Josh Sherman 2013-03-13 13:32:27 -04:00
parent e02890b97a
commit 1cd58e2cef
2 changed files with 26 additions and 20 deletions

View file

@ -55,19 +55,22 @@ class Database_PDO_Common extends Database_Common
throw new Exception('Data source name is not defined'); throw new Exception('Data source name is not defined');
} }
if ($this->driver == 'pdo_mysql') switch ($this->driver)
{ {
// Resolves "Invalid UTF-8 sequence" issues when encoding as JSON case 'pdo_mysql':
$this->attributes[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8'; // Resolves "Invalid UTF-8 sequence" issues when encoding as JSON
} // @todo Didn't resolve that issue, borked some other characters though
//$this->attributes[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8';
break;
if ($this->driver == 'pdo_pgsql') case 'pdo_pgsql':
{ // This combats a bug: https://bugs.php.net/bug.php?id=62571&edit=1
// This combats a bug: https://bugs.php.net/bug.php?id=62571&edit=1 $this->attributes[PDO::ATTR_PERSISTENT] = false;
$this->attributes[PDO::ATTR_PERSISTENT] = false;
// This allows for multiple prepared queries // This allows for multiple prepared queries
$this->attributes[PDO::ATTR_EMULATE_PREPARES] = true; $this->attributes[PDO::ATTR_EMULATE_PREPARES] = true;
break;
} }
} }

23
jar.php
View file

@ -1998,19 +1998,22 @@ class Database_PDO_Common extends Database_Common
throw new Exception('Data source name is not defined'); throw new Exception('Data source name is not defined');
} }
if ($this->driver == 'pdo_mysql') switch ($this->driver)
{ {
// Resolves "Invalid UTF-8 sequence" issues when encoding as JSON case 'pdo_mysql':
$this->attributes[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8'; // Resolves "Invalid UTF-8 sequence" issues when encoding as JSON
} // @todo Didn't resolve that issue, borked some other characters though
//$this->attributes[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8';
break;
if ($this->driver == 'pdo_pgsql') case 'pdo_pgsql':
{ // This combats a bug: https://bugs.php.net/bug.php?id=62571&edit=1
// This combats a bug: https://bugs.php.net/bug.php?id=62571&edit=1 $this->attributes[PDO::ATTR_PERSISTENT] = false;
$this->attributes[PDO::ATTR_PERSISTENT] = false;
// This allows for multiple prepared queries // This allows for multiple prepared queries
$this->attributes[PDO::ATTR_EMULATE_PREPARES] = true; $this->attributes[PDO::ATTR_EMULATE_PREPARES] = true;
break;
} }
} }