[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: The World According to Lua: How To?
- From: Klaus Ripke <paul-lua@...>
- Date: Sat, 19 Feb 2005 11:57:59 +0100
On Friday 18 February 2005 21:39, Glenn Maynard wrote:
> > > and using setlocale() to change the locale to UTF-8.
> > don't! It's not working by any means.
> In C? Of course it is. (Never in Lua--an extension language can't be
> changing the locale environment, since it's shared by its parent.)
a) lua has os.setlocale()
b) it is working for single-byte charsets as illustrated in earlier mail
c) it is not working for multi-byte, since lua string is written using the
single byte C API, not the wchar stuff you mention below
(what IS working, however, is collation of UTF-8 stuff)
> > no, to the very opposite: while the C API locale support will vary
> > largely, standard unicode support is 100% portable in Java and Tcl
> > and hence in the provided little lib (which is a port from Tcl).
> Huh? Lua is written in C, not Java or Tcl.
ah! oops!! my mistake!!!
But, surprise, Tcl is written in C, too!
And they have an excellent implementation of the Unicode stuff!!
Not relying on any external libs, just plain C, thus 100% portable!!!
And that's just what I ported to now be a lua lib...
> There are "portable"
> mechanisms for localization (eg. wctomb(), wcwidth(), wchar_t and friends),
> but not all systems have them (Windows, embedded systems, etc).
... and where they exist, they don't behave exactly the same.
So it's NOT portable.