]> source.dussan.org Git - nextcloud-server.git/commitdiff
UTF8 locale by default
authorGrundik <grundik@ololo.cc>
Sun, 8 Apr 2012 01:30:06 +0000 (05:30 +0400)
committerRobin Appelman <icewind@owncloud.com>
Thu, 12 Apr 2012 15:54:20 +0000 (17:54 +0200)
lib/base.php
lib/db.php

index 83dd0c98f45cdeef97421df94ff15e6657bf4a2e..15c90227fecc80a477318da8da1a6a75afc75a7e 100644 (file)
@@ -265,7 +265,7 @@ class OC{
        public static function init(){
                // register autoloader
                spl_autoload_register(array('OC','autoload'));
-
+               setlocale(LC_ALL, 'en_US.UTF-8');
                
                // set some stuff
                //ob_start();
index 9c46a40addbd95450d029a663fbe999bdee71f3d..9364b9e0015a91cd8671df775578db58ebfb4f12 100644 (file)
@@ -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();