Page MenuHomePhabricator

Incorrect Chinese unicode character saving in translation config.
Closed, DuplicatePublic

Description

Summary:
In Config > Core > Translations. If save Chinese JSON string like:

{
  "Hello": "你好"
}

will be converted and saved to:

{
  "Hello": "\u4f60\u597d"
}

Resolution:
libphutil/src/parser/PhutilJSON.php
change line 132:

return json_encode($value, JSON_UNESCAPED_SLASHES);

to:

return json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

Event Timeline

This behavior is not "incorrect", it just isn't the most human-readable format we could use. I'm going to merge this into T8973, which discusses this and other potential improvements to human-readability for JSON encoded for presentation.

Yes, it is not "incorrect" but it is not human-readable format problem same with T8973 either. Chinese / Japanese / Korean unicode should be shown as what it is instead of some unreadable unicode digitals, especially in TRANSLATION functions, otherwise how to translate and confirm that?