diff --git a/ChangeLog b/ChangeLog index 8b8fc0ab7d..6a294b4029 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Oct 30 09:31:45 2008 Nobuyoshi Nakada + + * encoding.c (rb_locale_encoding): makes an alias for locale. + [ruby-dev:36976] + + * encoding.c (rb_enc_set_default_external): ditto for external. + + * encoding.c (rb_enc_set_default_internal): ditto for internal. + Thu Oct 30 02:20:33 2008 Yusuke Endoh * array.c (rb_ary_sort_bang): remove SEGV when replacing array with diff --git a/encoding.c b/encoding.c index 632f323c3d..e9fcbfcb3e 100644 --- a/encoding.c +++ b/encoding.c @@ -996,11 +996,11 @@ rb_locale_encoding(void) int idx; if (NIL_P(charmap)) - return rb_usascii_encoding(); - else - idx = rb_enc_find_index(StringValueCStr(charmap)); - if (idx < 0) - return rb_ascii8bit_encoding(); + idx = rb_usascii_encindex(); + else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0) + idx = rb_ascii8bit_encindex(); + + if (rb_enc_registered("locale") < 0) enc_alias("locale", idx); return rb_enc_from_index(idx); } @@ -1057,6 +1057,7 @@ rb_enc_set_default_external(VALUE encoding) { default_external_index = rb_enc_to_index(rb_to_encoding(encoding)); default_external = 0; + enc_alias("external", default_external_index); } /* -2 => not yet set, -1 => nil */ @@ -1106,6 +1107,7 @@ rb_enc_set_default_internal(VALUE encoding) if (default_internal_index == rb_usascii_encindex()) default_internal_index = rb_utf8_encindex(); default_internal = 0; + enc_alias("internal", default_internal_index); } /*