Fixed massive-edit-plugins to show multi-byte string values properly.

This commit is contained in:
Hirofumi Kosaka 2016-02-22 17:44:27 +09:00
parent 010f531b97
commit 38ba2cfcbd
2 changed files with 6 additions and 6 deletions

View File

@ -58,7 +58,7 @@ if (is_ajax()) {
}
}
echo json_encode($plugin);
echo io_json_mb_encode($plugin);
return;
}
@ -97,7 +97,7 @@ if (is_ajax()) {
$agents[] = $current_element;
}
echo json_encode($agents);
echo io_json_mb_encode($agents);
return;
}
@ -125,7 +125,7 @@ if (is_ajax()) {
}, array());
echo json_encode($module_plugin_macros);
echo io_json_mb_encode($module_plugin_macros);
return;
}
@ -225,7 +225,7 @@ if ($update) {
$module_macros = json_encode($result_macros, JSON_FORCE_OBJECT);
$module_macros = io_json_mb_encode($result_macros, JSON_FORCE_OBJECT);
if (empty($module_macros)) {
$module_macros = $module_macros_str;
}

View File

@ -431,8 +431,8 @@ function __ ($string /*, variable arguments */) {
*
* @param string Text string to be encoded.
*/
function io_json_mb_encode($string) {
$v = json_encode($string);
function io_json_mb_encode($string, $encode_options = 0){
$v = json_encode($string, $encode_options);
$v = preg_replace_callback("/\\\\u([0-9a-zA-Z]{4})/",
create_function('$matches', 'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UTF-16");'
), $v);