Fixed a `String#squeeze` bug in handling `iso-8859-1` strings; ref #4127

parent 54ec08c7
...@@ -573,7 +573,7 @@ str_squeeze(mrb_state *mrb, mrb_value str, mrb_value v_pat) ...@@ -573,7 +573,7 @@ str_squeeze(mrb_state *mrb, mrb_value str, mrb_value v_pat)
else { else {
for (i=j=0; i<len; i++,j++) { for (i=j=0; i<len; i++,j++) {
if (i>j) s[j] = s[i]; if (i>j) s[j] = s[i];
if (s[i] == lastch) { if (s[i] >= 0 && s[i] == lastch) {
flag_changed = TRUE; flag_changed = TRUE;
j--; j--;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment