-
-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
add a config for toLua for non-UTF-8 escape to hex.
-- lua-parser internal function
function escape(s)
if checkutf8 and utf8.len(s) == nil then
local r = ""
for i=1, #s do
r = r .. string.format("\\x%02X", string.byte(s, i))
end
return r
else
return defaultEscape(s)
end
end
--
toLua()or allow custom escape
function escape(s, default)
if utf8.len(s) == nil then
local r = ""
for i=1, #s do
r = r .. string.format("\\x%02X", string.byte(s, i))
end
return r
else
return default(s)
end
end
toLua({escape=escape})or custom function return nil for default
function escape(s)
if utf8.len(s) == nil then
local r = ""
for i=1, #s do
r = r .. string.format("\\x%02X", string.byte(s, i))
end
return r
else
return nil
end
end
toLua({escape=escape})Metadata
Metadata
Assignees
Labels
No labels