1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

transcode.c: use string

* 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
parent d0987afc74
commit fdfb939d72
2 changed files with 5 additions and 2 deletions

View file

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

View file

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