summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-07-11 15:16:49 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-07-11 15:16:49 -0700
commit0328db0c2b22e9ef83f1e66cad45a330935ddb87 (patch)
tree6cda91e5d55a5f212913480e600d16050d199bb5
parentMerge branch 'dr/progress-i18n' (diff)
parentgettext: always use UTF-8 on native Windows (diff)
downloadtgif-0328db0c2b22e9ef83f1e66cad45a330935ddb87.tar.xz
Merge branch 'kb/windows-force-utf8'
Windows update. * kb/windows-force-utf8: gettext: always use UTF-8 on native Windows
-rw-r--r--gettext.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gettext.c b/gettext.c
index d4021d690c..3f2aca5c3b 100644
--- a/gettext.c
+++ b/gettext.c
@@ -12,7 +12,25 @@
#ifndef NO_GETTEXT
# include <locale.h>
# include <libintl.h>
-# ifdef HAVE_LIBCHARSET_H
+# ifdef GIT_WINDOWS_NATIVE
+
+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
# include <langinfo.h>