mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
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).
This commit is contained in:
1 file changed
+3
@@ -55,6 +55,9 @@ locale_charmap(VALUE (*conv)(const char *))
|
||||
#elif defined HAVE_LANGINFO_H
|
||||
codeset = nl_langinfo(CODESET);
|
||||
ASSUME(codeset);
|
||||
# ifdef __APPLE__
|
||||
if (!*codeset) codeset = "UTF-8";
|
||||
# endif
|
||||
#else
|
||||
# error locale_charmap() is not implemented
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user