UTF8 locale by default
This commit is contained in:
parent
d9aa31fd92
commit
7e7de25710
|
@ -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 {
|
||||||
$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 {
|
||||||
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();
|
||||||
|
|
Loading…
Reference in New Issue