summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-01 09:41:08 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-01 09:41:08 +0000
commitb1bcb8265d7a06efeb876a9d70997ff50e90296d (patch)
tree92ae4e5642445d76568b1cadbfb2aa7bd821b9ed /file.c
parentffdaca1d748804f2b5ca2de612f17cf6c78d351b (diff)
merge revision(s) r33525: [Backport #6104]
* file.c (rb_file_join): honor input encodings than ASCII-8BIT. [ruby-core:40338] [Bug #5483] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/file.c b/file.c
index f6ec06bd4e..67b281aba1 100644
--- a/file.c
+++ b/file.c
@@ -3837,7 +3837,10 @@ rb_file_join(VALUE ary, VALUE sep)
FilePathStringValue(tmp);
}
name = StringValueCStr(result);
- if (i > 0 && !NIL_P(sep)) {
+ if (i == 0) {
+ rb_enc_copy(result, tmp);
+ }
+ else if (!NIL_P(sep)) {
tail = chompdirsep(name);
if (RSTRING_PTR(tmp) && isdirsep(RSTRING_PTR(tmp)[0])) {
rb_str_set_len(result, tail - name);