|
> >>Is there a way to covert a string whose characters are encoded in utf8, to
> >>a string with characters encoded in iso-8859-1, just using lua standard
> >>libs? I cannot use libs with C codes.
> >>
> [...]
>
> Actually, the Latin 1 subset of unicode has the same codepoints as
> Latin1. It's just that UTF-8 is a different encoding. The following
> suffices to do the conversion with Lua 5.3:
>
> [...]
In Lua 5.3, that would do it:
string.gsub(s, utf8.charpattern, function (c)
return string.char(utf8.codepoint(c))
end)
-- Roberto