diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-05 14:15:15 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-05 14:15:15 +0000 |
commit | e1c14eabd548d275e3f978192260c8a7d619cc71 (patch) | |
tree | 18ee180061bab005ddf11c639def16a0815254fa /string.c | |
parent | f229a0642e7dd09c5b88b8041be4e6df0829371a (diff) |
merge revision(s) 28104:
* string.c (rb_str_inspect): inspect as ASCII when the codepoint
of a character in Unicode string is ASCII printable one.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -4166,7 +4166,10 @@ rb_str_inspect(VALUE str) else { if (p - n > prev) str_buf_cat(result, prev, p - n - prev); if (unicode_p) { - if (c < 0x10000) { + if (c < 0x100 && ISPRINT(c)) { + snprintf(buf, CHAR_ESC_LEN, "%c", c); + } + else if (c < 0x10000) { snprintf(buf, CHAR_ESC_LEN, "\\u%04X", c); } else { |