Subject: About testing locale set up.
To: None <>
From: Rui-Xiang Guo <>
List: current-users
Date: 04/06/2001 21:50:32
Hi, here are some codes:


#include <stdio.h>
#include <locale.h>
#  include <langinfo.h>
#include <X11/Xlib.h>
#include <X11/Xlocale.h>

    printf("LC_CTYPE = %s\n", setlocale(LC_CTYPE, ""));
    printf("encoding = %s\n", nl_langinfo(CODESET));
    if (XSupportsLocale() == True)
        printf("X Locale = OK\n");

I save them as localetest.c then compile it with this command:

gcc localetest.c -I/usr/X11R6/include -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib         -lX11 -lXext

then I got the a.out file and run it. It print such message (I set the locale with zh_TW.Big5):

        LC_CTYPE = zh_TW.Big5
        encoding = 
        X Locale = OK

Why "encoding" get the NULL string? It seems to our "langinfo.h" file not
complete as Linux or FreeBSD? How to fix it?