diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-06 17:09:03 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-06 17:09:03 +0000 |
commit | 85e4c89675d601fb9fc81b7e8985a166757c7509 (patch) | |
tree | ee591453670b3cffb00a339134bd3a689e00838d /ext/psych | |
parent | 611159923088a098ee5903e7fb356ec7f12debd1 (diff) | |
download | ruby-85e4c89675d601fb9fc81b7e8985a166757c7509.tar.gz |
* 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
Diffstat (limited to 'ext/psych')
-rw-r--r-- | ext/psych/parser.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/psych/parser.c b/ext/psych/parser.c index 9808c6b60e..6f4c4569e9 100644 --- a/ext/psych/parser.c +++ b/ext/psych/parser.c @@ -146,10 +146,11 @@ static VALUE transcode_io(VALUE src, int * parser_encoding) return src; } - rb_raise(rb_eArgError, "YAML file must be UTF-8, UTF-16LE, or UTF-16BE, not %s", - rb_enc_name(rb_enc_from_index(io_external_enc_index))); + /* If the external encoding is something we don't know how to handle, + * fall back to YAML_ANY_ENCODING. */ + *parser_encoding = YAML_ANY_ENCODING; - return Qnil; + return src; } #endif |