Here is a patch for this issue.
But I suspect it may cause another issue.
diff --git a/array.c b/array.c.new
index e58ac0b..bdad94d 100644
--- a/array.c
+++ b/array.c.new
@@ -1792,19 +1792,24 @@ inspect_ary(VALUE ary, VALUE dummy, int recur)
int tainted = OBJ_TAINTED(ary);
int untrust = OBJ_UNTRUSTED(ary);
long i;
-
VALUE s, str, temp;
if (recur) return rb_usascii_str_new_cstr("[...]");
str = rb_str_buf_new2("[");
-
temp = rb_str_buf_new2(", ");
for (i=0; i<RARRAY_LEN(ary); i++) {
s = rb_inspect(RARRAY_PTR(ary)[i]);
if (OBJ_TAINTED(s)) tainted = TRUE;
if (OBJ_UNTRUSTED(s)) untrust = TRUE;
- if (i > 0) rb_str_buf_cat2(str, ", ");
- else rb_enc_copy(str, s);
- if (i > 0) {
-
temp = rb_str_conv_enc(temp,rb_enc_get(temp),rb_enc_get(str));
-
rb_str_buf_append(str, temp);
- } else
-
str = rb_str_conv_enc(str,rb_enc_get(str),rb_enc_get(s));
rb_str_buf_append(str, s);
}
- rb_str_buf_cat2(str, "]");
- temp = rb_str_conv_enc(rb_str_buf_new2("]"),rb_usascii_encoding(),rb_enc_get(str));
- rb_str_buf_append(str, temp);
if (tainted) OBJ_TAINT(str);
if (untrust) OBJ_UNTRUST(str);
return str;