我发现了一件与JSON相关的奇怪事情,这取决于使用WordPress的站点语言。
例如,当站点语言设置为英语且您查看页面的源代码时,系统脚本如下所示:
var thickboxL10n = {"next":"Next >","prev":"< Prev","image":"Image","of":"of","close":"Close","noiframes":"This feature requires inline frames. You have iframes disabled or your browser does not support them.","loadingAnimation":"https:\\/\\/site.com\\/wp-includes\\/js\\/thickbox\\/loadingAnimation.gif"};
但是,当我将站点语言更改为俄语(或其他非拉丁语)时,我看到脚本变成这样:
var thickboxL10n = {"next":"\\u0414\\u0430\\u043b\\u0435\\u0435 \\u2192","prev":"\\u2190 \\u041d\\u0430\\u0437\\u0430\\u0434","image":"\\u0418\\u0437\\u043e\\u0431\\u0440\\u0430\\u0436\\u0435\\u043d\\u0438\\u0435","of":"\\u0438\\u0437","close":"\\u0417\\u0430\\u043a\\u0440\\u044b\\u0442\\u044c","noiframes":"\\u042d\\u0442\\u0430 \\u0444\\u0443\\u043d\\u043a\\u0446\\u0438\\u044f \\u0442\\u0440\\u0435\\u0431\\u0443\\u0435\\u0442 \\u043f\\u043e\\u0434\\u0434\\u0435\\u0440\\u0436\\u043a\\u0438 \\u043f\\u043b\\u0430\\u0432\\u0430\\u044e\\u0449\\u0438\\u0445 \\u0444\\u0440\\u0435\\u0439\\u043c\\u043e\\u0432. \\u0423 \\u0432\\u0430\\u0441 \\u043e\\u0442\\u043a\\u043b\\u044e\\u0447\\u0435\\u043d\\u044b \\u0442\\u0435\\u0433\\u0438 iframe, \\u043b\\u0438\\u0431\\u043e \\u0432\\u0430\\u0448 \\u0431\\u0440\\u0430\\u0443\\u0437\\u0435\\u0440 \\u0438\\u0445 \\u043d\\u0435 \\u043f\\u043e\\u0434\\u0434\\u0435\\u0440\\u0436\\u0438\\u0432\\u0430\\u0435\\u0442.","loadingAnimation":"https:\\/\\/krutygolov.pp.ua\\/wp-includes\\/js\\/thickbox\\/loadingAnimation.gif"};
我认为,这与
wp_json_encode()
函数,用于JSON编码(不确定)。
有没有办法JSON_UNESCAPED_UNICODE
默认情况下在WordPress中?我想在源代码中看到Далее
代替\\u0414\\u0430\\u043b\\u0435\\u0435
或者JSON验证不是不可能的?