More thorough escaping for JSON control chars
This commit is contained in:
parent
4f6575a987
commit
0cbcea29dd
@ -37,7 +37,9 @@ ser["number"] = function(x)
|
||||
end
|
||||
ser["boolean"] = ser["number"]
|
||||
ser["string"] = function(x)
|
||||
return string_gsub(string_format("%q", x), "\n", "n")
|
||||
return string_gsub(string_format("%q", x), "%c", function(c)
|
||||
return "\\00" .. string_format("%02x", string_byte(c))
|
||||
end)
|
||||
end
|
||||
ser["table"] = function(x)
|
||||
local arr = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user