e$B1sF#$G$9!#e(B
e$B%"%9%-!<Hs8_49$JJ8;zNs$re(B String#dump e$B$9$k$He(B eval
e$B$G$-$J$$J8;zNs$,e(B
e$BF@$i$l$^$7$?!#e(B
$ ./ruby -e ‘p “\u3042”.encode(“UTF-16LE”).dump’
““B0”.force_encoding(“UTF-16LE”\x00”
Index: string.c
— string.c (revision 23159)
+++ string.c (working copy)
@@ -4291,7 +4291,7 @@
result = rb_str_new5(str, 0, len);
p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str);
- q = RSTRING_PTR(result); qend = q + len;
-
q = RSTRING_PTR(result); qend = q + len + 1;
*q++ = ‘"’;
while (p < pend) {
Index: test/ruby/test_m17n.rb
===================================================================
— test/ruby/test_m17n.rb (revision 23159)
+++ test/ruby/test_m17n.rb (working copy)
@@ -241,6 +241,9 @@
u("\xfc"),
“\u3042”,
“ascii”, -
"\u3042".encode("UTF-16LE"),
-
"\u3042".encode("UTF-16BE"),
].each do |str|
assert_equal(str, eval(str.dump), “[ruby-dev:33142]”)
end