Bug #6698 » utf8_mac_for_filesystem_encoding_on_osx.diff
encoding.c | ||
---|---|---|
enc_set_filesystem_encoding(void)
|
||
{
|
||
int idx;
|
||
#if defined NO_LOCALE_CHARMAP
|
||
#if defined(__APPLE__) && ( defined(__MACH__) || defined(__DARWIN__) )
|
||
idx = rb_enc_find_index("UTF8-MAC");
|
||
#elif defined NO_LOCALE_CHARMAP
|
||
idx = rb_enc_to_index(rb_default_external_encoding());
|
||
#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;
|