Merge branch 'bad_unicode' into 'master'

add check to prevent bad unicode from crashing the server

See merge request VanessaE/led_marquee!4
This commit is contained in:
Vanessa Dannenberg 2019-07-06 02:17:06 +00:00
commit 8d3a0e92de

View File

@ -128,7 +128,12 @@ local make_iso = function(s)
local s2 = ""
while i <= string.len(s) do
if string.byte(s,i) > 159 then
s2 = s2..string.char(get_iso(string.sub(s, i, i+1)))
local ciso = get_iso(string.sub(s, i, i+1))
if ciso >= 0 and ciso < 256 then
s2 = s2..string.char(ciso)
else
s2 = s2..string.char(127)
end
i = i + 2
else
s2 = s2..string.sub(s, i, i)