Bug #6698 » utf8_mac_for_filesystem_encoding_on_osx.diff
encoding.c | ||
---|---|---|
1212 | 1212 |
enc_set_filesystem_encoding(void) |
1213 | 1213 |
{ |
1214 | 1214 |
int idx; |
1215 |
#if defined NO_LOCALE_CHARMAP |
|
1215 | ||
1216 |
#if defined(__APPLE__) && ( defined(__MACH__) || defined(__DARWIN__) ) |
|
1217 |
idx = rb_enc_find_index("UTF8-MAC"); |
|
1218 |
#elif defined NO_LOCALE_CHARMAP |
|
1216 | 1219 |
idx = rb_enc_to_index(rb_default_external_encoding()); |
1217 | 1220 |
#elif defined _WIN32 || defined __CYGWIN__ |
1218 | 1221 |
char cp[sizeof(int) * 8 / 3 + 4]; |
1219 | 1222 |
snprintf(cp, sizeof cp, "CP%d", AreFileApisANSI() ? GetACP() : GetOEMCP()); |
1220 | 1223 |
idx = rb_enc_find_index(cp); |
1221 |
if (idx < 0) idx = rb_ascii8bit_encindex(); |
|
1222 | 1224 |
#else |
1223 | 1225 |
idx = rb_enc_to_index(rb_default_external_encoding()); |
1224 | 1226 |
#endif |
1227 |
if (idx < 0) idx = rb_ascii8bit_encindex(); |
|
1225 | 1228 | |
1226 | 1229 |
enc_alias_internal("filesystem", idx); |
1227 | 1230 |
return idx; |