diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 5c4439bd083..a2e6a9e3b83 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -796,9 +796,12 @@ class DoliDBMssql */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { - // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci + if (empty($charset)) $charset=$this->forcecharset; + if (empty($collation)) $collation=$this->forcecollate; + + // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci $sql = 'CREATE DATABASE '.$database; - $sql.= ' DEFAULT CHARACTER SET '.$this->forcecharset.' DEFAULT COLLATE '.$this->forcecollate; + $sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation; $ret=$this->query($sql); if (! $ret) { diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index cd295d68cc2..6f978b0b0fd 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -797,7 +797,7 @@ class DoliDBMysql function DDLCreateDb($database,$charset='',$collation='',$owner='') { if (empty($charset)) $charset=$this->forcecharset; - if (empty($collation)) $collation=$this->collation; + if (empty($collation)) $collation=$this->forcecollate; // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci $sql = 'CREATE DATABASE '.$database; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 6b82861d1f7..7afea5a8da3 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -791,7 +791,7 @@ class DoliDBMysqli function DDLCreateDb($database,$charset='',$collation='',$owner='') { if (empty($charset)) $charset=$this->forcecharset; - if (empty($collation)) $collation=$this->collation; + if (empty($collation)) $collation=$this->forcecollate; // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci $sql = 'CREATE DATABASE '.$database; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index fa0a3b0eef4..8d7d59e6de8 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -979,7 +979,7 @@ class DoliDBPgsql function DDLCreateDb($database,$charset='',$collation='',$owner='') { if (empty($charset)) $charset=$this->forcecharset; - if (empty($collation)) $collation=$this->collation; + if (empty($collation)) $collation=$this->forcecollate; $ret=$this->query('CREATE DATABASE '.$database.' OWNER '.$owner.' ENCODING \''.$charset.'\''); return $ret; diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 673d5c1d4e7..c7a02ecded1 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -939,7 +939,7 @@ class DoliDBSqlite function DDLCreateDb($database,$charset='',$collation='',$owner='') { if (empty($charset)) $charset=$this->forcecharset; - if (empty($collation)) $collation=$this->collation; + if (empty($collation)) $collation=$this->forcecollate; // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci $sql = 'CREATE DATABASE '.$database;