From: Junio C Hamano Date: Thu, 11 Jul 2019 22:16:49 +0000 (-0700) Subject: Merge branch 'kb/windows-force-utf8' X-Git-Tag: v2.23.0-rc0~45 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0328db0c2b22e9ef83f1e66cad45a330935ddb87?hp=ff2ea392f9ffc32fdce168b9325d30a27c397684 Merge branch 'kb/windows-force-utf8' Windows update. * kb/windows-force-utf8: gettext: always use UTF-8 on native Windows --- 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 # include -# 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 # else # include