diff options
-rw-r--r-- | index.php | 6 | ||||
-rw-r--r-- | libraries/classes/Charsets.php | 25 |
2 files changed, 29 insertions, 2 deletions
@@ -369,12 +369,14 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) { echo ' <li id="li_select_mysql_charset">'; echo ' ' , __('Server charset:') , ' ' . ' <span lang="en" dir="ltr">'; - $unicode = Charsets::$mysql_charset_map['utf-8']; + + $charset = Charsets::getServerCharset($GLOBALS['dbi']); $charsets = Charsets::getMySQLCharsetsDescriptions( $GLOBALS['dbi'], $GLOBALS['cfg']['Server']['DisableIS'] ); - echo ' ' , $charsets[$unicode], ' (' . $unicode, ')'; + + echo ' ' , $charsets[$charset], ' (' . $charset, ')'; echo ' </span>' . ' </li>' . ' </ul>' diff --git a/libraries/classes/Charsets.php b/libraries/classes/Charsets.php index 4f73e0eed8..c01159271d 100644 --- a/libraries/classes/Charsets.php +++ b/libraries/classes/Charsets.php @@ -49,6 +49,14 @@ class Charsets ); private static $_charsets = array(); + + /** + * The charset for the server + * + * @var string + */ + private static $_charset_server; + private static $_charsets_descriptions = array(); private static $_collations = array(); private static $_default_collations = array(); @@ -127,6 +135,23 @@ class Charsets } } + /** + * Get current MySQL server charset. + * + * @param DatabaseInterface $dbi DatabaseInterface instance + * + * @return string + */ + public static function getServerCharset(DatabaseInterface $dbi) + { + if (self::$_charset_server) { + return self::$_charset_server; + } else { + self::$_charset_server = $dbi->getVariable('character_set_server'); + return self::$_charset_server; + } + } + /** * Get MySQL charsets * |