Problem with locale and XFree86 under RedHat
laurent.jean-rigaud at regis-dgac.net
laurent.jean-rigaud at regis-dgac.net
Fri Apr 23 16:06:08 UTC 2004
Hi,
We currently porting some applications from HP to LINUX RedHat and we meet
a problem with locale. The problem appears with RH7.2+XFREE430, RH9 et
RHEL3.0.
The problem is if we set a locale to en_GB, our test app seems to crash in
XIM code. If the locale is set to en_GB.utf8 , the problem disapears...
So it is mandatory to set the locale to something UTF8 compatible ?
Here is the code for testing : it compiles with "gcc -DLINUX -g -static -o pb_label_accent pb_label_accent.c
-I/usr/X11R6/include -L/usr/X11R6/lib -lMrm -lXm -lXp -lXext -lXt -lSM
-lICE -lXmu -lX11 -lm"
#----------------
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>
#include <Xm/PushBP.h>
#include <Xm/Display.h>
#include <X11/Shell.h>
#include <X11/X.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
static Widget g_toplevel = NULL;
static Widget g_wts_configu = NULL;
static XmString valider_simple;
static XtAppContext g_app_context;
#ifdef hp700
static const char *const NOM_LOCALE = "english.iso88591";
#endif /* hp700 */
/*************************************************************
* Sous Robin, l'utilisation de la locale qui suit, marche. *
* Sous samekh, le meme positionnement entraine un coredump *
*************************************************************/
/*
#ifdef LINUX
static const char *const NOM_LOCALE = "en_GB";
#endif
*/
/*************************************************************
* Sous samekh, l'utilisation de la locale qui suit empeche *
* la plante mais elle entraine un problème d'affichage des *
* accents dans les label lorsque l'on adresse un display *
* autre qu'un display LINUX *
*************************************************************/
#ifdef LINUX
static const char *const NOM_LOCALE = "en_GB";
#endif
int main
(
int argc,
char *argv[]
)
{
Widget wf_pere, wl_texte;
char buffer[255];
if (! setlocale (LC_ALL, NOM_LOCALE))
XtWarning ("locale not supported by C library, locale unchanged");
g_toplevel = XtVaAppInitialize (&g_app_context, "Test_samekh", NULL,
0, &argc, argv, NULL, NULL);
g_wts_configu = XtVaCreatePopupShell ("CONF",
transientShellWidgetClass, g_toplevel,
XtNtitle, "Test Label Accent",
XmNwidth, 200, XmNheight, 200,
XmNx, 100, XmNy, 100,
NULL);
wf_pere = XtVaCreateManagedWidget
("PERE", xmFormWidgetClass, g_wts_configu,
XmNborderWidth, 0,
XmNshadowThickness, 0,
XmNresizePolicy, XmRESIZE_GROW,
NULL);
sprintf (buffer, "%s", "Précédent");
valider_simple = XmStringGenerate (buffer, XmSTRING_DEFAULT_CHARSET,
XmCHARSET_TEXT, NULL);
wl_texte = XtVaCreateManagedWidget ("Valider", xmLabelWidgetClass,
wf_pere,
XmNx, 0, XmNy, 100,
XmNlabelString, valider_simple,
NULL);
XtPopup(g_wts_configu, XtGrabNone);
XmStringFree(valider_simple);
XtAppMainLoop(g_app_context);
return 0;
}
#----------------
Thanks for you help.
PS: maybe the problem come from GLIBC ?
More information about the xfree86-list
mailing list