[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unicode and UTF-8 the Lua way, mid-discussion (was Re: What do you miss most in Lua)
- From: Duncan Cross <duncan.cross@...>
- Date: Thu, 9 Feb 2012 20:29:32 +0000
On Thu, Feb 9, 2012 at 6:37 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> utf8.char(cp1, cp2, ...) -> string formed by code points cp1, cp2, ...
> (If cp1 is a table, string formed by the code points in it?)
How about if cp1 is a function, it builds the string from (the equivalent of):
for _, codepoint in cp1, cp2, ... do
-- append codepoint
end
Then if you have an ichars() method that returns a codepoint iterator,
and you have the same API for other encodings, converting from one
encoding to another becomes pretty easy:
u8encoded = utf8.char(utf16.ichars(u16encoded))
-Duncan
- References:
- Unicode and UTF-8 the Lua way, mid-discussion (was Re: What do you miss most in Lua), Jay Carlson
- Re: Unicode and UTF-8 the Lua way, mid-discussion (was Re: What do you miss most in Lua), Dirk Laurie
- Re: Unicode and UTF-8 the Lua way, mid-discussion (was Re: What do you miss most in Lua), Rob Hoelz
- Re: Unicode and UTF-8 the Lua way, mid-discussion (was Re: What do you miss most in Lua), Sam Roberts
- Re: Unicode and UTF-8 the Lua way, mid-discussion (was Re: What do you miss most in Lua), Roberto Ierusalimschy