Modified: MacRuby/trunk/lib/stringio.rb (4483 => 4484)
--- MacRuby/trunk/lib/stringio.rb 2010-08-31 08:47:59 UTC (rev 4483)
+++ MacRuby/trunk/lib/stringio.rb 2010-08-31 22:54:57 UTC (rev 4484)
@@ -102,7 +102,7 @@
self
end
-
+
# strio.string = string -> string
#
# Changes underlying String object, the subject of IO.
@@ -492,6 +492,10 @@
if @append || (pos >= string.length)
# add padding in case it's needed
str = str.rjust((pos + str.length) - string.length, "\000") if (pos > string.length)
+ enc1, enc2 = str.encoding, @string.encoding
+ if enc1 != enc2
+ str = str.dup.force_encoding(enc2)
+ end
@string << str
@pos = string.length
else