X Tutup
Skip to content

COMMON: Fix Unicode support in JSON#6601

Merged
lephilousophe merged 1 commit intoscummvm:masterfrom
chkuendig:json-unicode-fix
May 18, 2025
Merged

COMMON: Fix Unicode support in JSON#6601
lephilousophe merged 1 commit intoscummvm:masterfrom
chkuendig:json-unicode-fix

Conversation

@chkuendig
Copy link
Member

JSON allows for keys and string values to be unicode encoded. Currently all non-ASCI characters are stripped by JSON::untaintContents and replaced with dots. This breaks access to files in cloud which have a unicode in the path (in my case it was Ultima IV™).

This PR removes JSON::untaintContents and replaces it with JSON::zeroTerminateContents and fixes a check to ignore char < 0 (which are all values >255 that overflow in a signed char to negative).

This was discussed also in detail on Discord earlier today: https://discord.com/channels/581224060529148060/711242520415174666/1369945380292395049. With @lephilousophe recommending changing this check instead of moving to unsigned chars.

@chkuendig chkuendig changed the title COMMON: Fix UTF support in JSON COMMON: Fix Unicode support in JSON May 8, 2025
@chkuendig chkuendig requested a review from lephilousophe May 18, 2025 08:57
@lephilousophe
Copy link
Member

Thanks, merging.
I was expecting another pair of eyes than ours.

@lephilousophe lephilousophe merged commit 3677c91 into scummvm:master May 18, 2025
8 checks passed
@chkuendig chkuendig deleted the json-unicode-fix branch August 4, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup