diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-02-04 18:11:22 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-02-04 18:11:22 +0900 |
| commit | 69fd1a592560d321061790c94f93532db93dccb9 (patch) | |
| tree | b7a94cb0998d7cdb6739dc550bf26ad1fe3e6513 /include | |
| parent | 3f7137feaeb3a86df01ae080b4d8826250f4ef29 (diff) | |
| download | mruby-69fd1a592560d321061790c94f93532db93dccb9.tar.gz mruby-69fd1a592560d321061790c94f93532db93dccb9.zip | |
Fix `Symbol#size` for multi-byte characters with `MRB_UTF8_STRING`
Before:
p :あ.size #=> 3
After:
p :あ.size #=> 1
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/string.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/mruby/string.h b/include/mruby/string.h index 3fe8295ff..6fe0556b0 100644 --- a/include/mruby/string.h +++ b/include/mruby/string.h @@ -439,6 +439,10 @@ void mrb_regexp_check(mrb_state *mrb, mrb_value obj); #define mrb_str_buf_cat(mrb, str, ptr, len) mrb_str_cat(mrb, str, ptr, len) #define mrb_str_buf_append(mrb, str, str2) mrb_str_cat_str(mrb, str, str2) +#ifdef MRB_UTF8_STRING +mrb_int mrb_utf8_len(const char *str, mrb_int byte_len); +#endif + MRB_END_DECL #endif /* MRUBY_STRING_H */ |
