Merge branch 'br/blame-ignore'
[gitweb.git] / gettext.c
index d4021d690c07237edefb0cf2869eb6795d227a54..3f2aca5c3b16d39375fab9b6203c67ae16209023 100644 (file)
--- a/gettext.c
+++ b/gettext.c
 #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>