Code

gettext.c: use libcharset.h instead of langinfo.h when available
authorErik Faye-Lund <kusmabite@gmail.com>
Tue, 28 Sep 2010 16:05:26 +0000 (18:05 +0200)
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 30 Oct 2010 07:10:06 +0000 (07:10 +0000)
commitf8972cd9e8418b04615669e9b8656cd32f4ed00c
tree3b0c052f3b815ea09c583ba909c18738a45a6add
parent8b458d6570c68f6683f705ada67ef39ce11b9267
gettext.c: use libcharset.h instead of langinfo.h when available

Change the git_setup_gettext function to use libcharset to query the
character set of the current locale if it's available. I.e. use it
instead of nl_langinfo if HAVE_LIBCHARSET_H is set.

The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.

GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.

The locale_charset function returns a `const char*', instead of
`char*` as nl_langinfo does. Change the declaration of the variable
we're using to store the `charset' in `git_setup_gettext' accordingly.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Makefile
config.mak.in
configure.ac
gettext.c