Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Fix database connection to use utf8 as standard.
Browse files Browse the repository at this point in the history
Currently the database connection uses "whatever" encoding for the connection. This means the encoding actually changed from server to server in my testing due to configuration differences.
So I fixed the encoding to be utf8 here. If there ever is the need for another encoding this must be made configurable.

Note: Magento also uses utf8 everywhere.
  • Loading branch information
Kira Backes committed May 22, 2015
1 parent 9fec0df commit 3004939
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Est/Handler/AbstractDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ protected function getDbConnection() {
}
}
$this->dbConnection = new PDO(
"mysql:host={$dbParameters['host']};dbname={$dbParameters['database']}",
"mysql:host={$dbParameters['host']};dbname={$dbParameters['database']};charset=utf8",
$dbParameters['username'],
$dbParameters['password']
$dbParameters['password'],
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")
);
}
return $this->dbConnection;
Expand Down

0 comments on commit 3004939

Please sign in to comment.