1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_inspect): increment by rb_enc_mbminlen(enc) for

broken byte sequence.  [ruby-core:27748]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-01-24 05:22:51 +00:00
parent 4b8e14c978
commit 83d9e9f42e
2 changed files with 10 additions and 4 deletions

View file

@ -1,7 +1,8 @@
Sun Jan 24 13:55:54 2010 Tanaka Akira <akr@fsij.org>
Sun Jan 24 14:21:48 2010 Tanaka Akira <akr@fsij.org>
* string.c (rb_enc_strlen_cr): increment by rb_enc_mbminlen(enc) for
broken byte sequence. [ruby-core:27748]
(rb_str_inspect): ditto.
Sun Jan 24 05:18:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>

View file

@ -4099,9 +4099,14 @@ rb_str_inspect(VALUE str)
n = rb_enc_precise_mbclen(p, pend, enc);
if (!MBCLEN_CHARFOUND_P(n)) {
if (p > prev) str_buf_cat(result, prev, p - prev);
snprintf(buf, CHAR_ESC_LEN, "\\x%02X", *p & 0377);
str_buf_cat(result, buf, strlen(buf));
prev = ++p;
n = rb_enc_mbminlen(enc);
if (pend < p + n)
n = pend - p;
while (n--) {
snprintf(buf, CHAR_ESC_LEN, "\\x%02X", *p & 0377);
str_buf_cat(result, buf, strlen(buf));
prev = ++p;
}
continue;
}
n = MBCLEN_CHARFOUND_LEN(n);