Closed

Description
As of now, jsony doesn't recognize surrogate pairs and just keeps them as-is, resulting in invalid UTF-8 characters:
import std/json
import pkg/jsony
type
TestObj = object
content: string
let
# A string with 🔒 emoji encoded both as normal UTF-8 and as a surrogate pair
raw = """{"content":"\uD83D\uDD12🔒"}"""
parsed = raw.fromJson(TestObj)
parsedStd = parseJson(raw).to(TestObj)
echo "jsony - ", parsed.content
echo "std/json - ", parsedStd.content
Both std/json and nim-json-serialization handle surrogates, so I think jsony should also support them.
Found out about this bug from a discussion with @zedeus.
Metadata
Metadata
Assignees
Labels
No labels