diff --git a/util/lua-ext.lua b/util/lua-ext.lua index e60297ba..8668a4ca 100644 --- a/util/lua-ext.lua +++ b/util/lua-ext.lua @@ -19,15 +19,3 @@ function astable(table) return {} end end - --- Lua 5.1, which ships with Tup, does not have a way of creating a string from --- a unicode codepoint... --- --- https://stackoverflow.com/a/7799843 -function unichr(ord) - if ord == nil then return nil end - if ord < 32 then return string.format('\\x%02x', ord) end - if ord < 126 then return string.char(ord) end - if ord < 65539 then return string.format("\\u%04x", ord) end - if ord < 1114111 then return string.format("\\u%08x", ord) end -end diff --git a/util/pokemon.lua b/util/pokemon.lua index d3091930..644412c4 100644 --- a/util/pokemon.lua +++ b/util/pokemon.lua @@ -2,7 +2,7 @@ function decodeFS(filename) return filename:gsub('_(%x%x%x%x)', function(hex) - return unichr(tonumber(hex, 16)) + return utf8.char(tonumber(hex, 16)) end) end