diff options
Diffstat (limited to 'includes/database/mysql/database.inc')
-rw-r--r-- | includes/database/mysql/database.inc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc index 552d95b8d..a3d711840 100644 --- a/includes/database/mysql/database.inc +++ b/includes/database/mysql/database.inc @@ -47,8 +47,15 @@ class DatabaseConnection_mysql extends DatabaseConnection { PDO::ATTR_CASE => PDO::CASE_LOWER, )); - // Force MySQL to use the UTF-8 character set by default. - $this->exec('SET NAMES "utf8"'); + // Force MySQL to use the UTF-8 character set. Also set the collation, if a + // certain one has been set; otherwise, MySQL defaults to 'utf8_general_ci' + // for UTF-8. + if (!empty($connection_options['collation'])) { + $this->exec('SET NAMES utf8 COLLATE ' . $connection_options['collation']); + } + else { + $this->exec('SET NAMES utf8'); + } // Force MySQL's behavior to conform more closely to SQL standards. // This allows Drupal to run almost seamlessly on many different |