lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Mike Pall wrote:
Hi,

Chris Marrin wrote:

I see that you can say "en-us.utf-8", but does it REQUIRE a language code? And is this cross-platform?


Yes, you need a language code. But it's ignored except for things
like the monetary symbol or collation order. IMHO it's best to
only set "ctype" (LC_CTYPE environment variable) to avoid some
other NLS pitfalls (e.g. the dot vs. comma problem with numbers).

The Unicode FAQ for Unix/Linux explains this and many more things
that have been discussed in this thread:

  http://www.cl.cam.ac.uk/~mgk25/unicode.html

Yes, my recollection is that this is a total morass. So it would be nice if Lua could "simplify" it by doing the right thing in its code. Perhaps os.setlocale("UTF8") could do some special processing to setup all the right values to get the same expected (or at least well-defined) results on all platforms.

Or maybe a new os.setencoding("UTF8") call could be created?

--
chris marrin              ,""$, "As a general rule,don't solve puzzles
chris@marrin.com        b`    $  that open portals to Hell" ,,.
        ,.`           ,b`    ,`                            , 1$'
     ,|`             mP    ,`                              :$$'     ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`