Asking a question about Linux

Pascale Dardailler dardaill@ilog.fr
Thu Apr 1 18:47:00 GMT 1999


Hello,

Sorry to disturb you, but I have no clue where to ask my question. I
asked a friend who gave me your name. Feel free to direct me to other
sources for finding answers.

I have a pretty stupid question, but I cannot find any answer on the
web, so perhaps you could enlight me.
I've been trying to understand why the setlocale on Linux does not work
as expected:


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

int main()
{
        setlocale(LC_ALL, "");

        printf("locale %s\n", setlocale(LC_ALL, NULL));

        printf("encoding %s\n", nl_langinfo(_NL_CTYPE_CODESET_NAME));

        printf("mb cur max size %d\n",
nl_langinfo(_NL_CTYPE_MB_CUR_MAX));

        printf("max char size %d\n", MB_CUR_MAX);

        return 0;
}


Then setting LC_ALL or LANG to fr_FR.ISO-8859-1, I get:

locale fr_FR
encoding ISO-8859-1
mb cur max size 2
max char size 2

Why is this 2 instead of 1?


How is internationalization supported in Linux and XFree86.

Thanks in advance for your advice and time?

    Pascale.



More information about the Libc-hacker mailing list