[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: detect the charset used by the os
- From: JM Fernandez <elcubion@...>
- Date: Sun, 28 Feb 2010 13:01:11 +0100
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