* transcode.c (econv_opts): get rid of inadvertent ID creation,
  and preserve argument encoding in error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-08-03 01:55:32 +00:00
Родитель d0987afc74
Коммит fdfb939d72
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -908,6 +908,9 @@ class TestEncodingConverter < Test::Unit::TestCase
ec1 = Encoding::Converter.new("", "", universal_newline: true) ec1 = Encoding::Converter.new("", "", universal_newline: true)
ec2 = Encoding::Converter.new("", "", newline: :universal) ec2 = Encoding::Converter.new("", "", newline: :universal)
assert_equal(ec1, ec2) assert_equal(ec1, ec2)
assert_raise_with_message(ArgumentError, /\u{3042}/) {
Encoding::Converter.new("", "", newline: "\u{3042}".to_sym)
}
end end
def test_default_external def test_default_external

Просмотреть файл

@ -2487,8 +2487,8 @@ econv_opts(VALUE opt, int ecflags)
/* ecflags |= ECONV_LF_NEWLINE_DECORATOR; */ /* ecflags |= ECONV_LF_NEWLINE_DECORATOR; */
} }
else if (SYMBOL_P(v)) { else if (SYMBOL_P(v)) {
rb_raise(rb_eArgError, "unexpected value for newline option: %s", rb_raise(rb_eArgError, "unexpected value for newline option: %"PRIsVALUE,
rb_id2name(SYM2ID(v))); rb_sym2str(v));
} }
else { else {
rb_raise(rb_eArgError, "unexpected value for newline option"); rb_raise(rb_eArgError, "unexpected value for newline option");