diff options
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -4572,7 +4572,11 @@ rb_str_inspect(VALUE str) } } switch (c) { - case '\0': cc = '0'; break; + case '\0': + if (p - n > prev) str_buf_cat(result, prev, p - n - prev); + str_buf_cat(result, "\\000", 4); + prev = p; + continue; case '\n': cc = 'n'; break; case '\r': cc = 'r'; break; case '\t': cc = 't'; break; |