* 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/trunk@29872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5d8a64b1af
commit
94e6c0c233
@ -1,3 +1,8 @@
|
|||||||
|
Mon Nov 22 21:30:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_inspect): fix for ascii-compatible external
|
||||||
|
encoding and different encoding string. [ruby-core:33283]
|
||||||
|
|
||||||
Mon Nov 22 18:45:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Nov 22 18:45:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/mkmf.rb (create_makefile): should not duplicate rules.
|
* lib/mkmf.rb (create_makefile): should not duplicate rules.
|
||||||
|
2
string.c
2
string.c
@ -4238,7 +4238,7 @@ rb_str_inspect(VALUE str)
|
|||||||
(cc == '$' || cc == '@' || cc == '{')))) {
|
(cc == '$' || cc == '@' || cc == '{')))) {
|
||||||
if (p - n > prev) str_buf_cat(result, prev, p - n - prev);
|
if (p - n > prev) str_buf_cat(result, prev, p - n - prev);
|
||||||
str_buf_cat2(result, "\\");
|
str_buf_cat2(result, "\\");
|
||||||
if (enc == resenc) {
|
if (asciicompat || enc == resenc) {
|
||||||
prev = p - n;
|
prev = p - n;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1897,6 +1897,14 @@ class TestString < Test::Unit::TestCase
|
|||||||
assert_equal('"\\u3042\\u3044\\u3046"', "\u3042\u3044\u3046".encode(e).inspect)
|
assert_equal('"\\u3042\\u3044\\u3046"', "\u3042\u3044\u3046".encode(e).inspect)
|
||||||
assert_equal('"ab\\"c"', "ab\"c".encode(e).inspect, bug4081)
|
assert_equal('"ab\\"c"', "ab\"c".encode(e).inspect, bug4081)
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
|
ext = Encoding.default_external
|
||||||
|
Encoding.default_external = "us-ascii"
|
||||||
|
i = "abc\"\\".force_encoding("utf-8").inspect
|
||||||
|
ensure
|
||||||
|
Encoding.default_external = ext
|
||||||
|
end
|
||||||
|
assert_equal('"abc\\"\\\\"', i, bug4081)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_prepend
|
def test_prepend
|
||||||
|
Loading…
x
Reference in New Issue
Block a user