From 69ee4246e59593b8bea71d4ad8a151d5a3d52ae9 Mon Sep 17 00:00:00 2001 From: naruse Date: Sun, 18 Jan 2009 18:32:24 +0000 Subject: * transcode.c (str_transcode0): fix: :xml option doesn't work on str.encode([options]) form without default_internal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index b01d4a1f08..1997e310c3 100644 --- a/transcode.c +++ b/transcode.c @@ -2457,7 +2457,8 @@ str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts) if (argc == 0) { arg1 = rb_enc_default_internal(); if (NIL_P(arg1)) { - return -1; + if (!ecflags) return -1; + arg1 = rb_obj_encoding(str); } ecflags |= ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE; } -- cgit v1.2.3