CC: Tweaked

CC: Tweaked

42M Downloads

textutils.unserialiseJSON() doesn't work with ä,ö,ü and ß

JakobDev opened this issue · 2 comments

commented

textutils.unserialiseJSON() gives a Unescaped whitespace error, if you use ä,ö,ü or ß in a string. Example:

textutils.unserialiseJSON('["äöüß"]')
commented

Oh boy, this one is fun. This is a bug in Cobalt's string comparison:

> string.char(127) >= '\0'
true
> string.char(128) >= '\0'
true -- PUC Lua
false -- Cobalt

It appears the comparison code incorrectly assumes Java's bytes are unsigned:

https://github.com/SquidDev/Cobalt/blob/1abc92d1a9a25141dfb95e44c7340ad234edbf18/src/main/java/org/squiddev/cobalt/LuaString.java#L216

commented

Well, that was an easy enough fix :).