Why WordPress not using JSON_UNESCAPED_UNICODE by default?
-
Hi everyone!
I’m using WordPress 5.5 (beta) and PHP 7.4. I found one strange thing related to JSON and depending on what site language using WordPress.
For example, when Site Language is set to English and you viewing source code of the page, system scripts looks like that:
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"};
But, when I change Site Language to Russian (or other non-latin language), I see that script becomes like this:
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:\/\/site.com\/wp-includes\/js\/thickbox\/loadingAnimation.gif"};
I think, it’s related to
wp_json_encode()
function, which using for JSON encoding (not sure).Is there any way, to use
JSON_UNESCAPED_UNICODE
in WordPress by default? I want to see in source codeДалее
insted of\u0414\u0430\u043b\u0435\u0435
or it’s not impossible due JSON validation?The page I need help with: [log in to see the link]
- The topic ‘Why WordPress not using JSON_UNESCAPED_UNICODE by default?’ is closed to new replies.