summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-26 06:24:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-26 06:24:29 +0000
commitcba2e89cdc2e48f865f0a3a68f8d0ebd2ae1d69c (patch)
tree766ecf87375a4c4f3b676fb1a5c7412988124a89 /file.c
parent49f6242b34f1daf9591b262c48723b7f2e7883d3 (diff)
* 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/trunk@33525 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 bd96ffee35..3107895037 100644
--- a/file.c
+++ b/file.c
@@ -3847,7 +3847,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);