[Dev-luatex] bug in os.execute?
taco at elvenkind.com
Thu Jun 10 19:03:18 CEST 2010
Elie Roux wrote:
> taco a écrit :
>> don't use an empty second argument to setlocale(). If you already
>> know that you want UTF-8, set it to a suitable value instead.
> The problem is that, IIUC, it's weird to put fr_FR.UTF-8 as a locale, as
> it's specific to my system... But I discovered that
> os.setenv("LC_CTYPE", nil)
> os.setenv("LC_CTYPE", "C")
> does the trick... with this it's the LANG environment variable
> (fr_FR.UTF-8) that will be set as LC_CTYPE.
> Setting setlocale (LC_CTYPE, "UTF-8"); in tetest.c does not solve
> the problem (strangely...). Is there another way?
Quite seriously: your C code should not be using libc functions that
depend on the current locale if you want it to produce reproducible
results. That's the core of the problem: LOCALE settings are unreliable,
unless your program explicitly sets the LOCALE itself.
So don't use that 'smart' printf() format, but just write (or reuse) an
int2utf8 C function.
More information about the dev-luatex