diff --git a/ChangeLog b/ChangeLog index 37c2c407d3..3fd413d3e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Aug 31 17:16:07 2008 Tanaka Akira + + * transcode.c (make_econv_exception): rename instance variable names + for storing encoding names. + (ecerr_source_encoding_name): method renamed. + (ecerr_destination_encoding_name): ditto. + Sun Aug 31 16:57:36 2008 Tanaka Akira * transcode.c (econv_putback): associate encoding to the result. diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index fd7bed5652..c18d7a8e65 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -455,8 +455,8 @@ class TestEncodingConverter < Test::Unit::TestCase err = assert_raise(Encoding::InvalidByteSequence) { "abc\xa4def".encode("ISO-8859-1", "EUC-JP") } - assert_equal("EUC-JP", err.source_encoding) - assert_equal("UTF-8", err.destination_encoding) + assert_equal("EUC-JP", err.source_encoding_name) + assert_equal("UTF-8", err.destination_encoding_name) assert_equal("\xA4".force_encoding("ASCII-8BIT"), err.error_bytes) assert_equal("d", err.readagain_bytes) assert_equal(false, err.incomplete_input?) @@ -466,8 +466,8 @@ class TestEncodingConverter < Test::Unit::TestCase err = assert_raise(Encoding::InvalidByteSequence) { "abc\xa4".encode("ISO-8859-1", "EUC-JP") } - assert_equal("EUC-JP", err.source_encoding) - assert_equal("UTF-8", err.destination_encoding) + assert_equal("EUC-JP", err.source_encoding_name) + assert_equal("UTF-8", err.destination_encoding_name) assert_equal("\xA4".force_encoding("ASCII-8BIT"), err.error_bytes) assert_equal(nil, err.readagain_bytes) assert_equal(true, err.incomplete_input?) @@ -477,8 +477,8 @@ class TestEncodingConverter < Test::Unit::TestCase err = assert_raise(Encoding::ConversionUndefined) { "abc\xa4\xa2def".encode("ISO-8859-1", "EUC-JP") } - assert_equal("UTF-8", err.source_encoding) - assert_equal("ISO-8859-1", err.destination_encoding) + assert_equal("UTF-8", err.source_encoding_name) + assert_equal("ISO-8859-1", err.destination_encoding_name) assert_equal("\u{3042}", err.error_char) end diff --git a/transcode.c b/transcode.c index 2afed2c770..a036c8f807 100644 --- a/transcode.c +++ b/transcode.c @@ -1667,8 +1667,8 @@ make_econv_exception(rb_econv_t *ec) } exc = rb_exc_new3(rb_eInvalidByteSequence, mesg); - rb_ivar_set(exc, rb_intern("source_encoding"), rb_str_new2(ec->last_error.source_encoding)); - rb_ivar_set(exc, rb_intern("destination_encoding"), rb_str_new2(ec->last_error.destination_encoding)); + rb_ivar_set(exc, rb_intern("source_encoding_name"), rb_str_new2(ec->last_error.source_encoding)); + rb_ivar_set(exc, rb_intern("destination_encoding_name"), rb_str_new2(ec->last_error.destination_encoding)); rb_ivar_set(exc, rb_intern("error_bytes"), bytes); rb_ivar_set(exc, rb_intern("readagain_bytes"), bytes2); rb_ivar_set(exc, rb_intern("incomplete_input"), ec->last_error.result == econv_incomplete_input ? Qtrue : Qfalse); @@ -1686,8 +1686,8 @@ make_econv_exception(rb_econv_t *ec) ec->last_error.destination_encoding); exc = rb_exc_new3(rb_eConversionUndefined, mesg); idx = rb_enc_find_index(ec->last_error.source_encoding); - rb_ivar_set(exc, rb_intern("source_encoding"), rb_str_new2(ec->last_error.source_encoding)); - rb_ivar_set(exc, rb_intern("destination_encoding"), rb_str_new2(ec->last_error.destination_encoding)); + rb_ivar_set(exc, rb_intern("source_encoding_name"), rb_str_new2(ec->last_error.source_encoding)); + rb_ivar_set(exc, rb_intern("destination_encoding_name"), rb_str_new2(ec->last_error.destination_encoding)); idx = rb_enc_find_index(ec->last_error.source_encoding); if (0 <= idx) rb_enc_associate_index(bytes, idx); @@ -2849,15 +2849,15 @@ rb_econv_check_error(rb_econv_t *ec) } static VALUE -ecerr_source_encoding(VALUE self) +ecerr_source_encoding_name(VALUE self) { - return rb_attr_get(self, rb_intern("source_encoding")); + return rb_attr_get(self, rb_intern("source_encoding_name")); } static VALUE -ecerr_destination_encoding(VALUE self) +ecerr_destination_encoding_name(VALUE self) { - return rb_attr_get(self, rb_intern("destination_encoding")); + return rb_attr_get(self, rb_intern("destination_encoding_name")); } static VALUE @@ -2936,12 +2936,12 @@ Init_transcode(void) rb_define_const(rb_cEncodingConverter, "CRLF_NEWLINE_ENCODER", INT2FIX(ECONV_CRLF_NEWLINE_ENCODER)); rb_define_const(rb_cEncodingConverter, "CR_NEWLINE_ENCODER", INT2FIX(ECONV_CR_NEWLINE_ENCODER)); - rb_define_method(rb_eConversionUndefined, "source_encoding", ecerr_source_encoding, 0); - rb_define_method(rb_eConversionUndefined, "destination_encoding", ecerr_destination_encoding, 0); + rb_define_method(rb_eConversionUndefined, "source_encoding_name", ecerr_source_encoding_name, 0); + rb_define_method(rb_eConversionUndefined, "destination_encoding_name", ecerr_destination_encoding_name, 0); rb_define_method(rb_eConversionUndefined, "error_char", ecerr_error_char, 0); - rb_define_method(rb_eInvalidByteSequence, "source_encoding", ecerr_source_encoding, 0); - rb_define_method(rb_eInvalidByteSequence, "destination_encoding", ecerr_destination_encoding, 0); + rb_define_method(rb_eInvalidByteSequence, "source_encoding_name", ecerr_source_encoding_name, 0); + rb_define_method(rb_eInvalidByteSequence, "destination_encoding_name", ecerr_destination_encoding_name, 0); rb_define_method(rb_eInvalidByteSequence, "error_bytes", ecerr_error_bytes, 0); rb_define_method(rb_eInvalidByteSequence, "readagain_bytes", ecerr_readagain_bytes, 0); rb_define_method(rb_eInvalidByteSequence, "incomplete_input?", ecerr_incomplete_input, 0);