summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 690ce86856..c70dc16441 100644
--- a/string.c
+++ b/string.c
@@ -2872,6 +2872,7 @@ rb_str_inspect(VALUE str)
char *p, *pend;
VALUE result = rb_str_buf_new2("");
+ rb_enc_associate(result, enc);
str_cat_char(result, '"', enc);
p = RSTRING_PTR(str); pend = RSTRING_END(str);
while (p < pend) {
@@ -2928,7 +2929,6 @@ rb_str_inspect(VALUE str)
str_cat_char(result, '"', enc);
OBJ_INFECT(result, str);
- rb_enc_associate(result, enc);
return result;
}