diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-05-28 16:59:51 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-05-28 16:59:51 +0900 |
commit | 7d144781a93df66379922717da711a09d1cf78ff (patch) | |
tree | 00bc8a4de93ae5f320f660c8501a8f9ce8cb536a | |
parent | 0a92c9f2b011c4cfcd1b894dccfd4e8c36cadd57 (diff) |
[Bug #20512] Set coderange in `Range#each` of strings
-rw-r--r-- | string.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -5156,7 +5156,9 @@ rb_str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALU if (c > e || (excl && c == e)) return beg; for (;;) { - if ((*each)(rb_enc_str_new(&c, 1, enc), arg)) break; + VALUE str = rb_enc_str_new(&c, 1, enc); + ENC_CODERANGE_SET(str, RUBY_ENC_CODERANGE_7BIT); + if ((*each)(str, arg)) break; if (!excl && c == e) break; c++; if (excl && c == e) break; |