diff options
Diffstat (limited to 'libraries/classes/Charsets.php')
-rw-r--r-- | libraries/classes/Charsets.php | 25 |
1 files changed, 25 insertions, 0 deletions
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 * |