From 51880da4e1dab7eb8419a6e05c7174d0066c6419 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 15 Jan 2013 13:38:04 -0500 Subject: [PATCH] Added configuration setting to allow DB character set specification; now defaults to UTF-8. --- config/vufind/config.ini | 5 +++++ module/VuFind/src/VuFind/Db/AdapterFactory.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/config/vufind/config.ini b/config/vufind/config.ini index cabd47b28e0..9751fdb2b67 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -259,6 +259,11 @@ require_login = true [Database] database = mysql://root@localhost/vufind +; The character set of the database -- may be latin1 or utf8; utf8 is STRONGLY +; RECOMMENDED and is the default if no value is set here. You may need latin1 +; for compatibility with existing VuFind 1.x installations. +;charset = utf8 + ; LDAP is optional. This section only needs to exist if the ; Authentication Method is set to LDAP. When LDAP is active, ; host, port, basedn and username are required. The remaining diff --git a/module/VuFind/src/VuFind/Db/AdapterFactory.php b/module/VuFind/src/VuFind/Db/AdapterFactory.php index ce1c3c42c29..cffba486b07 100644 --- a/module/VuFind/src/VuFind/Db/AdapterFactory.php +++ b/module/VuFind/src/VuFind/Db/AdapterFactory.php @@ -112,6 +112,9 @@ class AdapterFactory // Set up custom options by database type: switch (strtolower($type)) { case 'mysqli': + $config = ConfigReader::getConfig(); + $options['charset'] = isset($config->Database->charset) + ? $config->Database->charset : 'utf8'; $options['options'] = array('buffer_results' => true); break; } -- GitLab