Exemplo n.º 1
0
static int
rb_filesystem_encindex(void)
{
    int idx;
#if 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();
#elif defined __APPLE__
    idx = rb_utf8_encindex();
#else
    idx = rb_locale_encindex();
#endif

    if (rb_enc_registered("filesystem") < 0) enc_alias_internal("filesystem", idx);

    return idx;
}
Exemplo n.º 2
0
Arquivo: encoding.c Projeto: 217/ruby
rb_encoding *
rb_locale_encoding(void)
{
    return rb_enc_from_index(rb_locale_encindex());
}
Exemplo n.º 3
0
static VALUE encoding_spec_rb_locale_encindex(VALUE self) {
  return INT2NUM(rb_locale_encindex());
}