bug-gnulib
[Top][All Lists]
Advanced

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

Re: Accessing the environment's locale encoding settings


From: Bruno Haible
Subject: Re: Accessing the environment's locale encoding settings
Date: Sun, 20 Nov 2011 21:12:46 +0100
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

[CCing bug-gnulib. This is a reply to
 <http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00053.html>].

Hi Ludovic,

> I’m now convinced that an implicit setlocale(LC_ALL, "") is the right
> thing for ‘master’.

Good, glad that I could help with my opinion :)

> For 2.0, though, this brings us back to the hack I proposed at the
> beginning of this thread, namely trying to honor LC_CTYPE without
> actually calling setlocale, so that command-line arguments are suitably
> converted.
> 
> Could Gnulib’s get_charset_aliases be exported?

As documented in [1], not every possible code modification is suitable for
gnulib proper. In this case, in particular, I don't think that code
that returns the locale encoding _if_ setlocale (LC_CTYPE, "") had been
called, without really calling it, is a frequent enough use-case.

If I were you, I would start using the gnulib-tool option --local-dir
with a local modification of the 'localcharset' module, as documented in [1].
This means:

  1) Hack your local copy of localcharset.c so that it not only defines
     the locale_charset() function, but also an additional function
     environ_locale_charset() that looks only at the environment variables.

  2) Store this file in guile:

       $ cp ludo-localcharset.c guile/gnulib-local/lib/localcharset.c

     or if there are few changes just the differences:

       $ diff -u gnulib/lib/localcharset.c ludo-localcharset.c \
         > guile/gnulib-local/lib/localcharset.c.diff

  3) Pass the option
        --local-dir gnulib-local 
     to the gnulib-tool invocation in autogen.sh.

Bruno

[1] http://www.gnu.org/s/hello/manual/gnulib/Extending-Gnulib.html
-- 
In memoriam Kerem Yılmazer <http://en.wikipedia.org/wiki/Kerem_Yılmazer>



reply via email to

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