summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-24 09:32:06 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-24 09:32:06 +0000
commit014236612a0be2f07ac6e645bd5a32ddbe4c8b0f (patch)
tree58132d19eda328f2cf891ec4eff8f9e0d5b7785c /string.c
parentb4a2e268ea165c0b4321d76b68467ca6ca61a9aa (diff)
Fix String#rpartition(/re/) against a multibyte string.
* string.c (rb_str_rpartition): Fix String#rpartition(/re/) against a multibyte string. [Bug #8138] [ruby-dev:47183] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/string.c b/string.c
index 80869bd720..271afa75f0 100644
--- a/string.c
+++ b/string.c
@@ -7542,9 +7542,10 @@ rb_str_rpartition(VALUE str, VALUE sep)
if (regex) {
sep = rb_reg_nth_match(0, rb_backref_get());
}
- return rb_ary_new3(3, rb_str_substr(str, 0, pos),
+ return rb_ary_new3(3, rb_str_subseq(str, 0, pos),
sep,
- rb_str_substr(str,pos+str_strlen(sep,STR_ENC_GET(sep)),RSTRING_LEN(str)));
+ rb_str_subseq(str, pos+RSTRING_LEN(sep),
+ RSTRING_LEN(str)-pos-RSTRING_LEN(sep)));
}
/*