lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks Tony

By studying your solution (it has some errors but the general
idea is correct) and the original utf8toiso from Roberto, my solution is:

local char = string.char
local function isotoutf8 (s)
   s = s:gsub("([\128-\255])", function (c)
         local b = c:byte()
         return b < 192 and "\194"..c or "\195"..char(b-64)
       end)
   return s
end

It is better than yours because string concatenation is a slow operation.

Manel