mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix incorrect MRB_STR_ASCII flag update in mrb_str_dump
### Example (with `MRB_UTF8_STRING`) ```ruby s = "\u3042" p s.size s.dump p s.size ``` #### Before this patch: ``` 1 3 ``` #### After this patch: ``` 1 1 ```
This commit is contained in:
+7
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user