diff --git a/ChangeLog b/ChangeLog index 946d594ef..633524141 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,7 @@ danbarry - bug #1905711 [compatibility] Functions deprecated in PHP 5.3: is_a() and get_magic_quotes_gpc(), thanks to Dmitry N. Shilnikov - yrtimd - bug [lang] catalan wrong accented characters +- bug #1893034 [Export] SET NAMES for importing with command-line client 2.11.5.0 (2008-03-01) - bug #1862661 [GUI] Warn about rename deleting database diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 125a9536a..ed3ffe640 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -223,13 +223,23 @@ function PMA_exportHeader() $head .= $crlf; - $charset_of_file = isset($GLOBALS['charset_of_file']) ? $GLOBALS['charset_of_file'] : ''; - if (!empty($GLOBALS['asfile']) && isset($mysql_charset_map[$charset_of_file])) { + if (! empty($GLOBALS['asfile'])) { + // we are saving as file, therefore we provide charset information + // so that a utility like the mysql client can interpret + // the file correctly + if (isset($GLOBALS['charset_of_file']) && isset($mysql_charset_map[$GLOBALS['charset_of_file']])) { + // $cfg['AllowAnywhereRecoding'] was true so we got a charset from + // the export dialog + $set_names = $mysql_charset_map[$GLOBALS['charset_of_file']]; + } else { + // by default we use the connection charset + $set_names = $mysql_charset_map[$GLOBALS['charset']]; + } $head .= $crlf . '/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;' . $crlf . '/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;' . $crlf . '/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;' . $crlf - . '/*!40101 SET NAMES ' . $mysql_charset_map[$charset_of_file] . ' */;' . $crlf . $crlf; + . '/*!40101 SET NAMES ' . $set_names . ' */;' . $crlf . $crlf; } return PMA_exportOutputHandler($head);