Problem with locale and XFree86 under RedHat

[email protected] Fri, 23 Apr 2004 18:06:08 +0200
Newsgroups gmane.linux.redhat.xfree86
Message-ID <OFF7628AE5.6A54DC4C-ONC1256E7F.00580C68-C1256E7F.0058E611@stna.dgac.fr>
Message en plusieurs parties au format MIME
--===============0509052854==
Content-Type: multipart/alternative;
	boundary="=_alternative 0058E60CC1256E7F_="

Message en plusieurs parties au format MIME
--=_alternative 0058E60CC1256E7F_=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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=20
RHEL3.0.

The problem is if we set a locale to en=5FGB, our test app seems to crash i=
n=20
XIM code. If the locale is set to en=5FGB.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=5Flabel=5Faccent pb=5Flabel=5Faccent.c=20
-I/usr/X11R6/include -L/usr/X11R6/lib -lMrm -lXm -lXp -lXext -lXt -lSM=20
-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=5Ftoplevel =3D NULL;
static Widget  g=5Fwts=5Fconfigu =3D NULL;
static XmString valider=5Fsimple;

static XtAppContext g=5Fapp=5Fcontext;

#ifdef hp700
static const char *const NOM=5FLOCALE =3D "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=5FLOCALE =3D "en=5FGB";
   #endif
*/

/*************************************************************
 *  Sous samekh, l'utilisation de la locale qui suit empeche *
 *  la plante mais elle entraine un probl=E8me 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=5FLOCALE =3D "en=5FGB";
#endif


int main
(
 int   argc,
 char *argv[]
)
{
 Widget wf=5Fpere, wl=5Ftexte;
 char buffer[255];

    if (! setlocale (LC=5FALL, NOM=5FLOCALE))
        XtWarning ("locale not supported by C library, locale unchanged");

      g=5Ftoplevel =3D XtVaAppInitialize (&g=5Fapp=5Fcontext, "Test=5Fsamek=
h", NULL,=20
0, &argc, argv, NULL, NULL);=20

      g=5Fwts=5Fconfigu =3D XtVaCreatePopupShell ("CONF",=20
transientShellWidgetClass, g=5Ftoplevel,=20
                                            XtNtitle, "Test Label Accent", =


                                            XmNwidth, 200, XmNheight, 200, =


                                            XmNx, 100, XmNy, 100,
                                            NULL);

      wf=5Fpere =3D XtVaCreateManagedWidget
                ("PERE", xmFormWidgetClass, g=5Fwts=5Fconfigu,
                 XmNborderWidth,      0,
                 XmNshadowThickness,  0,
                 XmNresizePolicy,     XmRESIZE=5FGROW,
                 NULL);
=20
      sprintf (buffer, "%s", "Pr=E9c=E9dent");

      valider=5Fsimple =3D XmStringGenerate (buffer, XmSTRING=5FDEFAULT=5FC=
HARSET,=20
XmCHARSET=5FTEXT, NULL);

      wl=5Ftexte =3D XtVaCreateManagedWidget ("Valider", xmLabelWidgetClass=
,=20
wf=5Fpere,=20
                                          XmNx, 0, XmNy, 100,=20
                                          XmNlabelString, valider=5Fsimple,=
=20
                                          NULL);
=20
      XtPopup(g=5Fwts=5Fconfigu, XtGrabNone);

      XmStringFree(valider=5Fsimple);

      XtAppMainLoop(g=5Fapp=5Fcontext);

      return 0;
}
#----------------


Thanks for you help.

PS: maybe the problem come from GLIBC ?

--=_alternative 0058E60CC1256E7F_=--

--===============0509052854==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
xfree86-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/xfree86-list
IRC: #xfree86 on irc.redhat.com

--===============0509052854==--