Skip to content

Commit

Permalink
squash??? gettext: always use UTF-8 on native Windows
Browse files Browse the repository at this point in the history
We need to handle `LC_ALL=C` properly, as a new t7816 test that was just
introduced into `pu` would fail.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Jul 3, 2019
1 parent e874264 commit e561446
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion gettext.c
Expand Up @@ -13,7 +13,23 @@
# include <locale.h>
# include <libintl.h>
# ifdef GIT_WINDOWS_NATIVE
# define locale_charset() "UTF-8"

static const char *locale_charset(void)
{
const char *env = getenv("LC_ALL"), *dot;

if (!env || !*env)
env = getenv("LC_CTYPE");
if (!env || !*env)
env = getenv("LANG");

if (!env)
return "UTF-8";

dot = strchr(env, '.');
return !dot ? env : dot + 1;
}

# elif defined HAVE_LIBCHARSET_H
# include <libcharset.h>
# else
Expand Down

0 comments on commit e561446

Please sign in to comment.