diff --git a/encoding.c b/encoding.c index 38e28c8..c796a25 100644 --- a/encoding.c +++ b/encoding.c @@ -1212,16 +1212,19 @@ static int enc_set_filesystem_encoding(void) { int idx; + #if defined NO_LOCALE_CHARMAP idx = rb_enc_to_index(rb_default_external_encoding()); +#elif defined(__APPLE__) + idx = rb_enc_find_index("UTF8-MAC"); #elif defined _WIN32 || defined __CYGWIN__ char cp[sizeof(int) * 8 / 3 + 4]; snprintf(cp, sizeof cp, "CP%d", AreFileApisANSI() ? GetACP() : GetOEMCP()); idx = rb_enc_find_index(cp); - if (idx < 0) idx = rb_ascii8bit_encindex(); #else idx = rb_enc_to_index(rb_default_external_encoding()); #endif + if (idx < 0) idx = rb_ascii8bit_encindex(); enc_alias_internal("filesystem", idx); return idx;