From 4df965f4ed21353b6e0c89ac8286c64c6266ec04 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 17 Jun 2010 09:46:30 +0000 Subject: * file.c (rb_str_encode_ospath): when the encoding of the parameter is ASCII-8BIT, should recognize as filesystem encoding, and convert to UTF-8 on Windows. * file.c (realpath_rec): should convert to ospath encoding before calling lstat(). * file.c (rb_realpath_internal): resolved string should take over the encoding of base string. * transcode.c (rb_str_encode): should return new string always. fixed #3444. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index adc72a19d7..dadb57b90d 100644 --- a/transcode.c +++ b/transcode.c @@ -2805,7 +2805,12 @@ rb_str_encode(VALUE str, VALUE to, int ecflags, VALUE ecopts) int encidx = str_transcode0(argc, argv, &newstr, ecflags, ecopts); if (encidx < 0) return rb_str_dup(str); - RBASIC(newstr)->klass = rb_obj_class(str); + if (newstr == str) { + newstr = rb_str_dup(str); + } + else { + RBASIC(newstr)->klass = rb_obj_class(str); + } return str_encode_associate(newstr, encidx); } -- cgit v1.2.3