[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Will Lua kernel use Unicode in the future?
- From: Klaus Ripke <paul-lua@...>
- Date: Fri, 30 Dec 2005 17:21:11 +0100
On Fri, Dec 30, 2005 at 10:22:16AM -0500, Dave Dodge wrote:
> On Fri, Dec 30, 2005 at 11:36:13AM -0200, Roberto Ierusalimschy wrote:
> > > I think the more important addition would be an easy Lua way to set the
> > > locale to use the UTF8 encoding.
> >
> > os.setlocale("UTF-8") ?
>
> Locale names other that "C" and "" are implementation-defined. For
> example on Solaris 8 I believe the recommended locale name for this
> would be "en_US.UTF-8".
for sorting you would probably want to use something like
os.setlocale("UTF-8", "ctype")
os.setlocale("de_PHONEBOOK", "collate")
while in theory the collations are well defined
by unicode.org, in practice you face two problems:
a) the definitions are updated every now and then
b) the correctness and completeness of implementations varies
In other words it's about as portable as XML.
So for persistent data like a database index which relies upon
being sorted, using libc's strcoll means looking for trouble.
You should better link against a given version of ICU,
which is fairly complete and portable,
and make sure to ship that exact version with your app.
cheers