aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-22 07:29:32 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-22 07:29:32 +0000
commit203ebcbb92db498f093a0b1936a28165b73f5ad3 (patch)
treee26b94a2e75b58099b94ac005ea9343d62823384 /re.c
parent24b17a2e871ce96df361749d7f4c1e2a9cdc1f00 (diff)
downloadruby-203ebcbb92db498f093a0b1936a28165b73f5ad3.tar.gz
* re.c (rb_reg_expr_str): fix broken Regexp#inspect when it
is ASCII-8BIT and non-ASCII character. The length of character should be from original byte string. [ruby-core:31431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/re.c b/re.c
index db440d156a..f0213235c9 100644
--- a/re.c
+++ b/re.c
@@ -373,7 +373,8 @@ rb_reg_expr_str(VALUE str, const char *s, long len,
int l;
if (resenc) {
unsigned int c = rb_enc_mbc_to_codepoint(p, pend, enc);
- l = rb_str_buf_cat_escaped_char(str, c, unicode_p);
+ l = rb_enc_codelen(c, enc);
+ rb_str_buf_cat_escaped_char(str, c, unicode_p);
}
else {
l = mbclen(p, pend, enc);