summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
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);