summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
authorGrundik <grundik@ololo.cc>2012-04-08 05:30:06 +0400
committerRobin Appelman <icewind@owncloud.com>2012-04-12 17:54:20 +0200
commit7e7de25710c4f8d4069a63d40ea7497bc93ff82c (patch)
tree82167bb9db6d6893e18f805106f05bfaf988ed88 /lib/db.php
parentd9aa31fd922a3e316e5113854a06790ffb38685b (diff)
downloadnextcloud-server-7e7de25710c4f8d4069a63d40ea7497bc93ff82c.tar.gz
nextcloud-server-7e7de25710c4f8d4069a63d40ea7497bc93ff82c.zip
UTF8 locale by default
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/db.php b/lib/db.php
index 9c46a40addb..9364b9e0015 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -86,6 +86,7 @@ class OC_DB {
$user = OC_Config::getValue( "dbuser", "" );
$pass = OC_Config::getValue( "dbpassword", "" );
$type = OC_Config::getValue( "dbtype", "sqlite" );
+ $opts = array();
$datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' );
// do nothing if the connection already has been established
@@ -100,13 +101,14 @@ class OC_DB {
break;
case 'mysql':
$dsn='mysql:dbname='.$name.';host='.$host;
+ $opts[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES 'UTF8'";
break;
case 'pgsql':
$dsn='pgsql:dbname='.$name.';host='.$host;
break;
}
try{
- self::$PDO=new PDO($dsn,$user,$pass);
+ self::$PDO=new PDO($dsn,$user,$pass,$opts);
}catch(PDOException $e){
echo( '<b>can not connect to database, using '.$type.'. ('.$e->getMessage().')</center>');
die();