bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'setlocale'


From: Bruno Haible
Subject: Re: new module 'setlocale'
Date: Fri, 18 Feb 2011 04:23:24 +0100
User-agent: KMail/1.9.9

Eric Blake wrote:
> > #include <locale.h>
> > #include <stdio.h>
> > #include <stdlib.h> 
> > #include <string.h>
> > 
> > int
> > main ()
> > {
> >   if (setlocale (LC_ALL, "ar_SA.ISO-8859-1") != NULL)
> >     {
> >       printf ("%s\n", setlocale (LC_ALL, NULL));
> >       printf ("%s\n", setlocale (LC_CTYPE, NULL));
> >     }
> >   return 0;
> > }
> 
> This outputs nothing; setlocale failed.

Huh? This is surprising. And what does this program show?

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

int
main ()
{
  setenv ("LC_ALL", "ar_SA.ISO-8859-1", 1);
  if (setlocale (LC_ALL, "") != NULL)
    {
      printf ("%s\n", setlocale (LC_ALL, NULL));
      printf ("%s\n", setlocale (LC_CTYPE, NULL));
    }
  return 0;
}

Bruno
-- 
In memoriam Giordano Bruno <http://en.wikipedia.org/wiki/Giordano_Bruno>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]