Skip to content

Commit 334d493

Browse files
committed
mac: Fallback empty codeset to UTF-8
Workaround for a very strange behavior in macOS (reported about 10.15 at least): `nl_langinfo(CODESET)` returns an empty string until the parent shell sets `LC_CTYPE` (even if it doesn't export it).
1 parent 83bc6ce commit 334d493

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

localeinit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ locale_charmap(VALUE (*conv)(const char *))
5555
#elif defined HAVE_LANGINFO_H
5656
codeset = nl_langinfo(CODESET);
5757
ASSUME(codeset);
58+
# ifdef __APPLE__
59+
if (!*codeset) codeset = "UTF-8";
60+
# endif
5861
#else
5962
# error locale_charmap() is not implemented
6063
#endif

0 commit comments

Comments
 (0)