Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Use JSON_UNESCAPED_UNICODE #219

Closed
hdodov opened this issue Mar 11, 2020 · 1 comment
Closed

Use JSON_UNESCAPED_UNICODE #219

hdodov opened this issue Mar 11, 2020 · 1 comment
Labels
type: enhancement ✨ Is an enhancement (request)

Comments

@hdodov
Copy link

hdodov commented Mar 11, 2020

Currently, the editor saves Cyrillic characters escaped. For example, тест is saved like this:

{
    "attrs": [],
    "content": "\u0442\u0435\u0441\u0442",
    "id": "_1tug3ip28",
    "type": "paragraph"
}

I changed this line:

https://github.com/getkirby/editor/blob/master/field.php#L86

...to this:

return json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

...and it works as expected:

{
    "attrs": [],
    "content": "тест",
    "id": "_1tug3ip28",
    "type": "paragraph"
}

I think the editor should not escape Unicode characters to make text files smaller and to make them readable.

@bastianallgeier bastianallgeier added the type: enhancement ✨ Is an enhancement (request) label Mar 17, 2020
@bastianallgeier
Copy link
Member

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
type: enhancement ✨ Is an enhancement (request)
Projects
None yet
Development

No branches or pull requests

2 participants