Subject: strange setlocale() issue
To: None <>
From: Markus Illenseer <>
List: tech-userlevel
Date: 10/13/2003 22:46:56
This small programm does not work as expected:

#include <stdio.h>
#include <locale.h>

int main(void)
        const char *foo = "bar";
        if( NULL == setlocale(LC_ALL, "zh_TW.eucTW") )
                /* yes, I know, the 2nd argument should not be NULL */
                printf("error! locale is: %s\n", setlocale(LC_ALL, NULL));
                printf("OK %s\n", foo);

 It does print "Start" and then exits (!) with no error, coredump or
whatsoever. The other printf() commands are completely ignored, which
makes me believe, that the setlocale() in the if-clause crashes. A ktrace,
ktruss and gdb trace did not reveal anything, though.

 Any idea what might happen here?

 I am hunting down this bug for several days now, which started as a crash
of my Apache/PHP when using the above setlocale().

Markus Illenseer