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

#define USE_XOPEN_SOURCE

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

main()
{
    printf("LC_CTYPE = %s\n", setlocale(LC_CTYPE, ""));
#ifdef USE_XOPEN_SOURCE
    printf("encoding = %s\n", nl_langinfo(CODESET));
#endif
    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?