diff --git a/database.inc.php b/database.inc.php index ea52f10e..b13b2032 100644 --- a/database.inc.php +++ b/database.inc.php @@ -30,6 +30,7 @@ if ($_POST && !$error) { } page_header(strlen($_GET["db"]) ? lang('Alter database') . ": " . htmlspecialchars($_GET["db"]) : lang('Create database')); +$collations = collations(); if ($_POST) { echo "
" . lang('Unable to operate database') . ": " . htmlspecialchars($error) . "
\n"; @@ -39,8 +40,11 @@ if ($_POST) { $name = $_GET["db"]; $collate = array(); if (strlen($_GET["db"]) && ($result = $mysql->query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) { - if (preg_match('~ COLLATE ([^ ]+)~', $mysql->result($result, 1), $match)) { + $create = $mysql->result($result, 1); + if (preg_match('~ COLLATE ([^ ]+)~', $create, $match)) { $collate = $match[1]; + } elseif (preg_match('~ CHARACTER SET ([^ ]+)~', $create, $match)) { + $collate = $collations[$match[1]][0]; } $result->free(); } @@ -50,7 +54,7 @@ if ($_POST) {