[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT support "1.0" number format in German (and other) locales
- From: Mason Larobina <mason.larobina@...>
- Date: Thu, 10 Mar 2011 11:57:12 +0800
On 9 March 2011 19:04, Mike Pall <mikelu-1103@mike.de> wrote:
> Mason Larobina wrote:
>> Numbers of the format "1.0" cause luakit to crash when linked against
>> LuaJIT in German (and other) locales. Changing all .'s to ,'s solves
>> the problem (though that's not really a solution) and forcing a
>> non-German locale also works.
>
> This is not a "crash" by any definition. Please watch your
> terminology.
>
> Applications embedding Lua or LuaJIT should NOT set a numeric
> locale or explicitly set it to "C". Yes, this applies to _both_ VMs.
>
> Actually Lua has an ugly workaround for the issue with the parser.
> But it still fails with tonumber() and the explicit (tostring())
> or implicit number-to-string conversions. This affects e.g.
> print() and so on.
>
> The problem is deep inside libc in strtod() and sprintf(). These
> can neither be easily replaced, nor easily convinced to ignore the
> locale.
>
> I do not believe in curing a single symptom, so I won't add any
> kind of incomplete workaround for this to LuaJIT.
>
> One needs to fix the root cause, i.e. the embedding (luakit) must
> use setlocale(LC_NUMERIC, "C") after any setlocale calls in 3rd
> party libraries, but before initializing Lua or LuaJIT.
>
> --Mike
Thanks and sorry for overstating the problem. Forcing the LC_NUMERIC
locale to "C" will work perfectly for our needs (and will solve other
problems we've had when using the origina Lua libs).
Regards,
Mason.