Skip to content

Commit d3b9944

Browse files
committed
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. Signed-off-by: Karsten Blees <[email protected]>
1 parent ebc298d commit d3b9944

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

gettext.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# include <libintl.h>
1313
# ifdef HAVE_LIBCHARSET_H
1414
# include <libcharset.h>
15+
# elif defined GIT_WINDOWS_NATIVE
16+
# define locale_charset() "UTF-8"
1517
# else
1618
# include <langinfo.h>
1719
# define locale_charset() nl_langinfo(CODESET)

0 commit comments

Comments
 (0)