summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/irb/xmp.rb12
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b6067fd7c2e..cb95509c812 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jan 17 17:58:22 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * lib/irb/xmp.rb: multilingualizes XMP::StringInputMethod.
+ [ruby-core:21383].
+
Sat Jan 17 15:01:22 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/raddrinfo.c (make_inspectname): add a res argument to
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb
index 851852cd3eb..af87b488879 100644
--- a/lib/irb/xmp.rb
+++ b/lib/irb/xmp.rb
@@ -72,8 +72,20 @@ class XMP
end
def puts(exps)
+ if @encoding and exps.encoding != @encoding
+ enc = Encoding.compatible?(@exps.join("\n"), exps)
+ if enc.nil?
+ raise Encoding::CompatibilityError, "Encoding in which the passed exression is encoded is not compatible to the preceding's one"
+ else
+ @encoding = enc
+ end
+ else
+ @encoding = exps.encoding
+ end
@exps.concat exps.split(/\n/)
end
+
+ attr_reader :encoding
end
end