Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Aug 29, 2017
1 parent 596d9f2 commit 189deb6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion RedBeanPHP/Driver/RPDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,9 @@ protected function setEncoding()
$driver = $this->pdo->getAttribute( \PDO::ATTR_DRIVER_NAME );
if ($driver === 'mysql') {
$charset = $this->hasCap( 'utf8mb4' ) ? 'utf8mb4' : 'utf8';
$collate = '_unicode_ci';
if (version_compare(PHP_VERSION, '5.4', '>=')) {
$collate = $this->hasCap( 'utf8mb4_520' ) ? '_unicode_520_ci' : '_unicode_ci';
if ($this->hasCap( 'utf8mb4_520' )) $collate = '_unicode_520_ci';
}
$this->pdo->setAttribute(\PDO::MYSQL_ATTR_INIT_COMMAND, 'SET NAMES '. $charset ); //on every re-connect
$this->pdo->exec(' SET NAMES '. $charset); //also for current connection
Expand Down

0 comments on commit 189deb6

Please sign in to comment.