From 83a2a2ac54a71e1b2230536f40c3f21afde609bd Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 17 Jan 2009 12:19:53 +0000 Subject: merges r21625 from trunk into ruby_1_9_1. * lib/irb/xmp.rb: multilingualizes XMP::StringInputMethod. [ruby-core:21383]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/irb/xmp.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/irb') diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb index 851852cd3e..af87b48887 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 -- cgit v1.2.3