diff options
-rw-r--r-- | config.php.example | 2 | ||||
-rw-r--r-- | inc/database.inc.php | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/config.php.example b/config.php.example index 2e0ec117..1fded4da 100644 --- a/config.php.example +++ b/config.php.example @@ -11,7 +11,7 @@ define('CONFIG_SQL_DSN', 'mysql:dbname=openslx;host=localhost'); define('CONFIG_SQL_USER', 'openslx'); define('CONFIG_SQL_PASS', '%MYSQL_OPENSLX_PASS%'); // Set this to true if you mysql server doesn't default to UTF-8 on new connections -define('CONFIG_SQL_FORCE_UTF8', false); +define('CONFIG_SQL_FORCE_UTF8', true); define('CONFIG_TGZ_LIST_DIR', '/opt/openslx/configs'); diff --git a/inc/database.inc.php b/inc/database.inc.php index a729b7fc..0d48c23c 100644 --- a/inc/database.inc.php +++ b/inc/database.inc.php @@ -32,7 +32,10 @@ class Database if (self::$dbh !== false) return; try { - self::$dbh = new PDO(CONFIG_SQL_DSN, CONFIG_SQL_USER, CONFIG_SQL_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); + if (CONFIG_SQL_FORCE_UTF8) + self::$dbh = new PDO(CONFIG_SQL_DSN, CONFIG_SQL_USER, CONFIG_SQL_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); + else + self::$dbh = new PDO(CONFIG_SQL_DSN, CONFIG_SQL_USER, CONFIG_SQL_PASS); } catch (PDOException $e) { Util::traceError('Connecting to the local database failed: ' . $e->getMessage()); } |