{
"@context": "https://schema.org",
"@type": "Service",
"name": "Δώρα",
"url": "https://example.com/dora"
}6.2
The JSON in the textarea keeps the characters as entered ("name": "Δώρα", "https://schema.org").
On save the JSON is re-encoded, so the textarea shows:
{
"@context": "https:\/\/schema.org",
"@type": "Service",
"name": "\u0394\u03ce\u03c1\u03b1",
"url": "https:\/\/example.com\/dora"
}The frontend output is still correct, because the system plugin encodes it with JSON_UNESCAPED_UNICODE. But on any site in Greek, Cyrillic, Arabic, Chinese and so on, the JSON can no longer be read or edited in the backend, and every save escapes it again.
Joomla 6.2.0, PHP 8.3.36, MariaDB 10.5.26. The same code is in 6.2-dev and 6.3-dev.
The cause is plugins/schemaorg/custom/src/Extension/Custom.php, line 89, in onSchemaPrepareSave():
$schema->set('json', json_encode($json, JSON_PRETTY_PRINT));Adding two flags keeps the text readable, and the result is still valid JSON:
$schema->set('json', json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));The system plugin already uses both flags for the frontend output. Happy to open a pull request with this change.
| Labels |
Added:
No Code Attached Yet
|
||