[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc2) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 22 Jun 2011 14:52:59 -0300
> I think there's no easy way. On posix systems you can use newlocale /
> uselocale / freelocale to change it per-thread [1]
> On Windows you have SetThreadLocale [2]. So, changing locale in a thread
> safe way is not portable. Some #ifdefs will be needed.
On Posix, it seems that the following does the trick:
/* get current locale */
oldloc = uselocale((locale_t)0);
/* set new locale */
loc = newlocale(LC_ALL_MASK, "C", NULL);
uselocale(loc);
freelocale(loc);
/* restore previous locale */
uselocale(oldloc);
For Windows, I could not figure out how to set a "C" locale with its
"SetThreadLocale"...
-- Roberto