Skip to content

Commit ff37a26

Browse files
kbleesdscho
authored andcommitted
gettext: always use UTF-8 on native Windows
Git on native Windows exclusively uses UTF-8 for console output (both with MinTTY and native Console windows). Gettext uses setlocale() to determine the output encoding for translated text, however, MSVCRT's setlocale() doesn't support UTF-8. As a result, translated text is encoded in system encoding (GetAPC()), and non-ASCII chars are mangled in console output. Use gettext's bind_textdomain_codeset() to force the encoding to UTF-8 on native Windows. In this developers' setup, HAVE_LIBCHARSET_H is apparently defined, but we *really* want to override the locale_charset() here. Signed-off-by: Karsten Blees <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent aa25c82 commit ff37a26

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gettext.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#ifndef NO_GETTEXT
1313
# include <locale.h>
1414
# include <libintl.h>
15-
# ifdef HAVE_LIBCHARSET_H
15+
# ifdef GIT_WINDOWS_NATIVE
16+
# define locale_charset() "UTF-8"
17+
# elif defined HAVE_LIBCHARSET_H
1618
# include <libcharset.h>
1719
# else
1820
# include <langinfo.h>

0 commit comments

Comments
 (0)