Full JSON export contains Unicode unsupported by Godot4 JSON parser
cospan opened this issue ยท comments
First, Thank you for this great tool, I'm having a lot of fun with it!
Description
When importing a fully exported JSON into something like Godot 4 I receive an error:
"Parse JSON failed. Error at line 0: Invalid UTF-16 sequence in string, unpaired trail surrogate"
I tracked it down to this following line:
{"id":"marker25","name":"Goldemeagon Idol","legend":"An ancient idol. It has an inscription, but no one can translate it:\n <div style="font-size: 1.8em; line-break: anywhere;">\udc1b\ud802๐ \ud802\ud802\ud802\ud802\ud802\ud802๐ ต\udc26๐ ฟ๐ \udc18๐ \udc01\udc13\udc16\udc1d\udc21\udc26\udc11๐ \udc38\udc17\udc2c\ud802\ud802\ud802๐ ซ\ud802\ud802๐ ท๐ ฌ\udc17๐ ฎ๐ ๐ ฆ๐ ฑ\ud802๐ \ud802\ud802๐ \udc0e\udc0c๐ \udc19"}
I'm guessing the 'Goldemeagon' is random as well as the marker but the main issue is the '\ud802' could it be replaced with something else?
Steps to reproduce
- Create a map
- Export full JSON
- Open this page: http://jsonviewer.stack.hu/
- Copy the json data into the 'text' tab and search for 'ud802'
Expected behaviour
A happy JSON parser, specifically one that does this: (<UTF-16 Value> & 0xfffffc00) != 0xd800
Actual behaviour
JSON parser doesn't like the unicode character
This is what actually causes an error in the JSON parser: (<UTF-16 Value> & 0xfffffc00) == 0xd800
Attached JSON file
Generator version
1.89.11
Browser version
Chrome Version 109.0.5414.119 (Official Build) (64-bit)
Thanks for any help!
Dave
Hello. This marker has a bunch of random rare Unicode chars, that's expected. I see that this particular char is Invalid Character. So I believe the issue is that system doesn't know this character, probably it doesn't support the latest Unicode. In any case this is a valid Unicode char, I am not quite sure why JSON parser doesn't like it. Do you have any suggestions?
Thanks for getting back to me so quickly!
If it's a valid Unicode then you should not change anything. I have a workaround for this temporarily and I can look into this on the Godot side for a more permanent solution.
Thanks again,
Dave