aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/string.c b/string.c
index 168e7a6b82..452e4affc1 100644
--- a/string.c
+++ b/string.c
@@ -3311,9 +3311,11 @@ rb_str_inspect(VALUE str)
p += n;
if (c == '"'|| c == '\\' ||
- (c == '#' && p < pend &&
- (cc = rb_enc_codepoint(p,pend,enc),
- (cc == '$' || cc == '@' || cc == '{')))) {
+ (c == '#' &&
+ p < pend &&
+ MBCLEN_CHARFOUND(rb_enc_precise_mbclen(p,pend,enc)) &&
+ (cc = rb_enc_codepoint(p,pend,enc),
+ (cc == '$' || cc == '@' || cc == '{')))) {
prefix_escape(result, c, enc);
}
else if (c == '\n') {