summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorHiroshi Mimaki <[email protected]>2019-10-23 15:44:21 +0900
committerHiroshi Mimaki <[email protected]>2019-10-23 15:44:21 +0900
commit4eb8fca14008222ad3f835c29678fa11ad2c06b5 (patch)
treefd05103a2e73accd33f28c4c48721f9a06b1cc59 /src/string.c
parent4c91adc4b209163f4609e308bf773c6833513b55 (diff)
parentfa85f91e0e3ebff7b2626bfcf550821445c064d7 (diff)
downloadmruby-4eb8fca14008222ad3f835c29678fa11ad2c06b5.tar.gz
mruby-4eb8fca14008222ad3f835c29678fa11ad2c06b5.zip
Merge branch 'master' into stable
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c
index d3774f8c4..6ab9a1ff7 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1388,8 +1388,13 @@ str_escape(mrb_state *mrb, mrb_value str, mrb_bool inspect)
}
mrb_str_cat_lit(mrb, result, "\"");
#ifdef MRB_UTF8_STRING
- mrb_str_ptr(str)->flags |= ascii_flag;
- mrb_str_ptr(result)->flags |= ascii_flag;
+ if (inspect) {
+ mrb_str_ptr(str)->flags |= ascii_flag;
+ mrb_str_ptr(result)->flags |= ascii_flag;
+ }
+ else {
+ RSTR_SET_ASCII_FLAG(mrb_str_ptr(result));
+ }
#endif
return result;