diff --git a/wire/modules/LanguageSupport/LanguageTranslator.php b/wire/modules/LanguageSupport/LanguageTranslator.php index 7ed4281f..d36744c3 100644 --- a/wire/modules/LanguageSupport/LanguageTranslator.php +++ b/wire/modules/LanguageSupport/LanguageTranslator.php @@ -464,11 +464,14 @@ public function getTextdomain($textdomain) { * */ public function encodeJSON($str) { - if(defined("JSON_PRETTY_PRINT")) { - return json_encode($str, JSON_PRETTY_PRINT); - } else { - return json_encode($str); - } + $options = 0; + if(defined("JSON_PRETTY_PRINT")) $options = $options | JSON_PRETTY_PRINT; + // encode multibyte Unicode characters unescaped + if(defined("JSON_UNESCAPED_UNICODE")) $options = $options | JSON_UNESCAPED_UNICODE; + // don't escape slashes + if(defined("JSON_UNESCAPED_SLASHES")) $options = $options | JSON_UNESCAPED_SLASHES; + + return json_encode($str, $options); } }