зеркало из https://github.com/github/ruby.git
* 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:
Родитель
4b8e14c978
Коммит
83d9e9f42e
|
@ -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>
|
||||
|
||||
|
|
11
string.c
11
string.c
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче