Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--export.php1
-rw-r--r--libraries/config.default.php7
-rw-r--r--libraries/plugins/export/ExportJson.php17
4 files changed, 23 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1687da8185..0012b8de30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog
======================
4.8.0 (not yet released)
+- issue #12946 Allow to export JSON with unescaped unicode chars
4.7.0.0 (not yet released)
- patch #12233 [Display] Improve message when renaming database to same name
diff --git a/export.php b/export.php
index 17ec404776..aebab9f0e3 100644
--- a/export.php
+++ b/export.php
@@ -95,6 +95,7 @@ $post_params = array(
'ods_columns',
'json_structure_or_data',
'json_pretty_print',
+ 'json_unicode',
'xml_structure_or_data',
'xml_export_events',
'xml_export_functions',
diff --git a/libraries/config.default.php b/libraries/config.default.php
index a6fcca38cd..6c35ab41f3 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -1856,6 +1856,13 @@ $cfg['Export']['json_structure_or_data'] = 'data';
$cfg['Export']['json_pretty_print'] = false;
/**
+ * Export functions
+ *
+ * @global string $cfg['Export']['json_unicode']
+ */
+$cfg['Export']['json_unicode'] = true;
+
+/**
*
*
* @global string $cfg['Export']['sql_structure_or_data']
diff --git a/libraries/plugins/export/ExportJson.php b/libraries/plugins/export/ExportJson.php
index 0747dd35b3..5f582d5619 100644
--- a/libraries/plugins/export/ExportJson.php
+++ b/libraries/plugins/export/ExportJson.php
@@ -43,13 +43,18 @@ class ExportJson extends ExportPlugin
*/
public function encode($data)
{
+ $options = 0;
if (isset($GLOBALS['json_pretty_print'])
&& $GLOBALS['json_pretty_print']
) {
- return json_encode($data, JSON_PRETTY_PRINT);
- } else {
- return json_encode($data);
+ $options |= JSON_PRETTY_PRINT;
+ }
+ if (isset($GLOBALS['json_unicode'])
+ && $GLOBALS['json_unicode']
+ ) {
+ $options |= JSON_UNESCAPED_UNICODE;
}
+ return json_encode($data, $options);
}
/**
@@ -84,6 +89,12 @@ class ExportJson extends ExportPlugin
);
$generalOptions->addProperty($leaf);
+ $leaf = new BoolPropertyItem(
+ 'unicode',
+ __('Output unicode characters unescaped')
+ );
+ $generalOptions->addProperty($leaf);
+
// add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);