Skip to content
Snippets Groups Projects
Commit 7e7de257 authored by Grundik's avatar Grundik Committed by Robin Appelman
Browse files

UTF8 locale by default

parent d9aa31fd
No related branches found
No related tags found
No related merge requests found
...@@ -265,7 +265,7 @@ class OC{ ...@@ -265,7 +265,7 @@ class OC{
public static function init(){ public static function init(){
// register autoloader // register autoloader
spl_autoload_register(array('OC','autoload')); spl_autoload_register(array('OC','autoload'));
setlocale(LC_ALL, 'en_US.UTF-8');
// set some stuff // set some stuff
//ob_start(); //ob_start();
......
...@@ -86,6 +86,7 @@ class OC_DB { ...@@ -86,6 +86,7 @@ class OC_DB {
$user = OC_Config::getValue( "dbuser", "" ); $user = OC_Config::getValue( "dbuser", "" );
$pass = OC_Config::getValue( "dbpassword", "" ); $pass = OC_Config::getValue( "dbpassword", "" );
$type = OC_Config::getValue( "dbtype", "sqlite" ); $type = OC_Config::getValue( "dbtype", "sqlite" );
$opts = array();
$datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' ); $datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' );
// do nothing if the connection already has been established // do nothing if the connection already has been established
...@@ -100,13 +101,14 @@ class OC_DB { ...@@ -100,13 +101,14 @@ class OC_DB {
break; break;
case 'mysql': case 'mysql':
$dsn='mysql:dbname='.$name.';host='.$host; $dsn='mysql:dbname='.$name.';host='.$host;
$opts[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES 'UTF8'";
break; break;
case 'pgsql': case 'pgsql':
$dsn='pgsql:dbname='.$name.';host='.$host; $dsn='pgsql:dbname='.$name.';host='.$host;
break; break;
} }
try{ try{
self::$PDO=new PDO($dsn,$user,$pass); self::$PDO=new PDO($dsn,$user,$pass,$opts);
}catch(PDOException $e){ }catch(PDOException $e){
echo( '<b>can not connect to database, using '.$type.'. ('.$e->getMessage().')</center>'); echo( '<b>can not connect to database, using '.$type.'. ('.$e->getMessage().')</center>');
die(); die();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment