UTF8 locale by default

This commit is contained in:
Grundik 2012-04-08 05:30:06 +04:00 committed by Robin Appelman
parent d9aa31fd92
commit 7e7de25710
2 changed files with 4 additions and 2 deletions

View 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();

View 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();