* ext/psych/parser.c: fall back to any encoding if the external
encoding is wrong. [ruby-core:44163] * test/psych/test_encoding.rb: fix test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6111599230
commit
85e4c89675
@ -1,3 +1,9 @@
|
|||||||
|
Sat Apr 7 02:07:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* ext/psych/parser.c: fall back to any encoding if the external
|
||||||
|
encoding is wrong. [ruby-core:44163]
|
||||||
|
* test/psych/test_encoding.rb: fix test
|
||||||
|
|
||||||
Fri Apr 6 16:24:24 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
|
Fri Apr 6 16:24:24 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
* struct.c (documentation for rb_struct_members_m):
|
* struct.c (documentation for rb_struct_members_m):
|
||||||
|
@ -146,10 +146,11 @@ static VALUE transcode_io(VALUE src, int * parser_encoding)
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_raise(rb_eArgError, "YAML file must be UTF-8, UTF-16LE, or UTF-16BE, not %s",
|
/* If the external encoding is something we don't know how to handle,
|
||||||
rb_enc_name(rb_enc_from_index(io_external_enc_index)));
|
* fall back to YAML_ANY_ENCODING. */
|
||||||
|
*parser_encoding = YAML_ANY_ENCODING;
|
||||||
|
|
||||||
return Qnil;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -57,7 +57,7 @@ module Psych
|
|||||||
# If the external encoding isn't utf8, utf16le, or utf16be, we cannot
|
# If the external encoding isn't utf8, utf16le, or utf16be, we cannot
|
||||||
# process the file.
|
# process the file.
|
||||||
File.open(t.path, 'r', :encoding => 'SHIFT_JIS') do |f|
|
File.open(t.path, 'r', :encoding => 'SHIFT_JIS') do |f|
|
||||||
assert_raises ArgumentError do
|
assert_raises Psych::SyntaxError do
|
||||||
Psych.load(f)
|
Psych.load(f)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user