[MDEV-19760] json escaped unicode parse error Created: 2019-06-14  Updated: 2019-11-22  Resolved: 2019-09-12

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.3.15
Fix Version/s: 10.3.19, 10.4.9

Type: Bug Priority: Major
Reporter: Tim Westervoorde Assignee: Alexey Botchkov
Resolution: Fixed Votes: 1
Labels: json

Issue Links:
Relates
relates to MDEV-21124 JSON_UNQUOTE fails to process surroga... Open

 Description   

certain escaped unicode in json failes to parse, for example a smiley emoji:

SET @str = "{\"value\":\"\\ud83d\\ude0a\"}";
SET @path = "$.value";
select @str, @path, JSON_value(@str, @path);
+--------------------------+---------+-------------------------+
| @str                     | @path   | JSON_value(@str, @path) |
+--------------------------+---------+-------------------------+
| {"value":"\ud83d\ude0a"} | $.value | NULL                    |
+--------------------------+---------+-------------------------+

however this seems to work

SET @str = "{\"value\":\"\\u00e4\\u00f6\"}";
SET @path = "$.value";
select @str, @path, JSON_value(@str, @path);
+--------------------------+---------+-------------------------+
| @str                     | @path   | JSON_value(@str, @path) |
+--------------------------+---------+-------------------------+
| {"value":"\u00e4\u00f6"} | $.value | äö                      |
+--------------------------+---------+-------------------------+



 Comments   
Comment by Alexey Botchkov [ 2019-09-12 ]

https://github.com/MariaDB/server/commit/9554ef067878c4650ef4b9ad44e0b222cdb313a5

Generated at Thu Feb 08 08:54:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.