On Tue, Jul 09, 2002 at 06:09:01PM -0700, Keith Packard wrote:
> 
> Around 18 o'clock on Jul 9, Jungshik Shin wrote:
> 
> > >   a)      call setlocal (LC_ALL, "") myself?
> > 
> >   I'm afraid this can have an unexpected side effect, which could
> > surprise/upset some application program developers.
> 
> Agreed; this choice was somewhat rhetorical in nature...

You could do

  char * oldloc = strdup(setlocale(LC_CTYPE, NULL));
  setlocale(LC_CTYPE, "");
  ...
  setlocale(LC_CTYPE, oldloc);
  free(oldloc);

unless the program is multithreaded.

> > >   b)      use $LANG or $LC_CTYPE?
> >
> >   If this road is taken, it has to be determined which env.
> > variables have to be refered to in what order. AFAIK, SUS and POSIX say
> > that it's implementation-dependent.

POSIX fixes the order to LC_ALL, then LC_CTYPE, then LANG.

> Too bad the POSIX spec is closed so I can't check.

POSIX 2001 is freely available online at
  http://www.UNIX-systems.org/version3/
  http://www.opengroup.org/onlinepubs/007904975/toc.htm

Marius Gedminas
-- 
Life was simple before World War II. After that, we had systems.
                -- Grace Murray Hopper, 1987

Attachment: msg00979/pgp00000.pgp
Description: PGP signature

Reply via email to