diff --git a/index.php b/index.php
index 2aaefad400..0544c192a2 100644
--- a/index.php
+++ b/index.php
@@ -8,6 +8,7 @@
use PMA\libraries\RecentFavoriteTable;
use PMA\libraries\URL;
use PMA\libraries\Sanitize;
+use PMA\libraries\Charsets;
/**
* Gets some core libraries and displays a top message if required
@@ -311,8 +312,8 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
echo '
';
echo ' ' , __('Server charset:') , ' '
. ' ';
- echo ' ' , $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
- echo ' (' , $mysql_charset_map['utf-8'] , ')'
+ echo ' ' , $mysql_charsets_descriptions[Charsets::$mysql_charset_map['utf-8']];
+ echo ' (' , Charsets::$mysql_charset_map['utf-8'] , ')'
. ' '
. ' '
. ' '
diff --git a/libraries/Charsets.php b/libraries/Charsets.php
new file mode 100644
index 0000000000..baa2ee7cb1
--- /dev/null
+++ b/libraries/Charsets.php
@@ -0,0 +1,48 @@
+ 'big5',
+ 'cp-866' => 'cp866',
+ 'euc-jp' => 'ujis',
+ 'euc-kr' => 'euckr',
+ 'gb2312' => 'gb2312',
+ 'gbk' => 'gbk',
+ 'iso-8859-1' => 'latin1',
+ 'iso-8859-2' => 'latin2',
+ 'iso-8859-7' => 'greek',
+ 'iso-8859-8' => 'hebrew',
+ 'iso-8859-8-i' => 'hebrew',
+ 'iso-8859-9' => 'latin5',
+ 'iso-8859-13' => 'latin7',
+ 'iso-8859-15' => 'latin1',
+ 'koi8-r' => 'koi8r',
+ 'shift_jis' => 'sjis',
+ 'tis-620' => 'tis620',
+ 'utf-8' => 'utf8',
+ 'windows-1250' => 'cp1250',
+ 'windows-1251' => 'cp1251',
+ 'windows-1252' => 'latin1',
+ 'windows-1256' => 'cp1256',
+ 'windows-1257' => 'cp1257',
+ );
+}
diff --git a/libraries/common.inc.php b/libraries/common.inc.php
index 673975525f..3940956513 100644
--- a/libraries/common.inc.php
+++ b/libraries/common.inc.php
@@ -1021,32 +1021,3 @@ if (! defined('PMA_MINIMUM_COMMON')) {
include 'libraries/config/user_preferences.forms.php';
include_once 'libraries/config/page_settings.forms.php';
}
-
-/**
- * @global array MySQL charsets map
- */
-$GLOBALS['mysql_charset_map'] = array(
- 'big5' => 'big5',
- 'cp-866' => 'cp866',
- 'euc-jp' => 'ujis',
- 'euc-kr' => 'euckr',
- 'gb2312' => 'gb2312',
- 'gbk' => 'gbk',
- 'iso-8859-1' => 'latin1',
- 'iso-8859-2' => 'latin2',
- 'iso-8859-7' => 'greek',
- 'iso-8859-8' => 'hebrew',
- 'iso-8859-8-i' => 'hebrew',
- 'iso-8859-9' => 'latin5',
- 'iso-8859-13' => 'latin7',
- 'iso-8859-15' => 'latin1',
- 'koi8-r' => 'koi8r',
- 'shift_jis' => 'sjis',
- 'tis-620' => 'tis620',
- 'utf-8' => 'utf8',
- 'windows-1250' => 'cp1250',
- 'windows-1251' => 'cp1251',
- 'windows-1252' => 'latin1',
- 'windows-1256' => 'cp1256',
- 'windows-1257' => 'cp1257',
-);
diff --git a/libraries/plugins/export/ExportSql.php b/libraries/plugins/export/ExportSql.php
index 737922f81a..ac4380df5b 100644
--- a/libraries/plugins/export/ExportSql.php
+++ b/libraries/plugins/export/ExportSql.php
@@ -15,6 +15,7 @@ use PMA\libraries\properties\options\items\NumberPropertyItem;
use PMA\libraries\properties\options\groups\OptionsPropertyMainGroup;
use PMA\libraries\properties\options\groups\OptionsPropertyRootGroup;
use PMA\libraries\properties\options\groups\OptionsPropertySubgroup;
+use PMA\libraries\Charsets;
use PMA\libraries\DatabaseInterface;
use PMA\libraries\plugins\ExportPlugin;
use PMA\libraries\Util;
@@ -624,7 +625,7 @@ class ExportSql extends ExportPlugin
*/
public function exportFooter()
{
- global $crlf, $mysql_charset_map;
+ global $crlf;
$foot = '';
@@ -665,7 +666,6 @@ class ExportSql extends ExportPlugin
public function exportHeader()
{
global $crlf, $cfg;
- global $mysql_charset_map;
if (isset($GLOBALS['sql_compatibility'])) {
$tmp_compat = $GLOBALS['sql_compatibility'];
@@ -739,13 +739,13 @@ class ExportSql extends ExportPlugin
// so that a utility like the mysql client can interpret
// the file correctly
if (isset($GLOBALS['charset'])
- && isset($mysql_charset_map[$GLOBALS['charset']])
+ && isset(Charsets::$mysql_charset_map[$GLOBALS['charset']])
) {
// we got a charset from the export dialog
- $set_names = $mysql_charset_map[$GLOBALS['charset']];
+ $set_names = Charsets::$mysql_charset_map[$GLOBALS['charset']];
} else {
// by default we use the connection charset
- $set_names = $mysql_charset_map['utf-8'];
+ $set_names = Charsets::$mysql_charset_map['utf-8'];
}
if ($set_names == 'utf8' && PMA_MYSQL_INT_VERSION > 50503) {
$set_names = 'utf8mb4';
diff --git a/test/classes/plugin/export/ExportSqlTest.php b/test/classes/plugin/export/ExportSqlTest.php
index 7e369d7951..c3b89c1a58 100644
--- a/test/classes/plugin/export/ExportSqlTest.php
+++ b/test/classes/plugin/export/ExportSqlTest.php
@@ -451,7 +451,6 @@ class ExportSqlTest extends PMATestCase
$GLOBALS['sql_disable_fk'] = true;
$GLOBALS['sql_use_transaction'] = true;
$GLOBALS['charset'] = 'utf-8';
- $GLOBALS['mysql_charset_map']['utf-8'] = true;
$GLOBALS['sql_utc_time'] = true;
$GLOBALS['old_tz'] = 'GMT';
$GLOBALS['asfile'] = 'yes';
@@ -501,7 +500,6 @@ class ExportSqlTest extends PMATestCase
$GLOBALS['sql_use_transaction'] = true;
$GLOBALS['sql_include_comments'] = true;
$GLOBALS['charset'] = 'utf-8';
- $GLOBALS['mysql_charset_map']['utf-8'] = true;
$dbi = $this->getMockBuilder('PMA\libraries\DatabaseInterface')
->disableOriginalConstructor()