summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 13:22:53 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 13:22:53 +0000
commitd3418343048213457d0686b807404babc949e994 (patch)
tree593cc1dba359009738d4cf552a7b22ebc3aa52d8 /string.c
parent0d0636d22ce7bd4729d749ca36cf2cde5175d815 (diff)
merges r29868 and r29872 from trunk into ruby_1_9_2.
-- * string.c (rb_str_inspect): append for each chars instead of bulk copy if encoding conversion is needed. [ruby-core:33283] -- * string.c (rb_str_inspect): fix for ascii-compatible external encoding and different encoding string. [ruby-core:33283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/string.c b/string.c
index 1aae6120aa..542aaff0ee 100644
--- a/string.c
+++ b/string.c
@@ -4195,8 +4195,10 @@ rb_str_inspect(VALUE str)
(cc == '$' || cc == '@' || cc == '{')))) {
if (p - n > prev) str_buf_cat(result, prev, p - n - prev);
str_buf_cat2(result, "\\");
- prev = p - n;
- continue;
+ if (asciicompat || enc == resenc) {
+ prev = p - n;
+ continue;
+ }
}
switch (c) {
case '\n': cc = 'n'; break;