summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-10-23 09:55:47 +0900
committerGitHub <[email protected]>2019-10-23 09:55:47 +0900
commit2f0bf1e110fca2e255c01fa578472aef69fd847e (patch)
treeb7306e4b4c51f0d5172eb7e33cae633d6c591e9b /src
parent1aacde20fa6b2a4e5fd397e6117d789b93b166fb (diff)
parent41c43234a7870af32cf4bec830229df0dea1c142 (diff)
downloadmruby-2f0bf1e110fca2e255c01fa578472aef69fd847e.tar.gz
mruby-2f0bf1e110fca2e255c01fa578472aef69fd847e.zip
Merge pull request #4785 from shuujii/fix-incorrect-MRB_STR_ASCII-flag-update-in-mrb_str_dump
Fix incorrect `MRB_STR_ASCII` flag update in `mrb_str_dump`
Diffstat (limited to 'src')
-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;