From 8c3efa494091e6e0001f4a708fb7568c242387b9 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Jan 2020 15:40:03 +0900 Subject: Use Reline.encoding_system_needs if exists --- lib/irb/ext/save-history.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/irb/ext/save-history.rb') diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb index c0d4d372b7..edc4f234cc 100644 --- a/lib/irb/ext/save-history.rb +++ b/lib/irb/ext/save-history.rb @@ -72,7 +72,7 @@ module IRB end history_file = IRB.rc_file("_history") unless history_file if File.exist?(history_file) - open(history_file) do |f| + open(history_file, "r:#{IRB.conf[:LC_MESSAGES].encoding}") do |f| f.each { |l| l = l.chomp if self.class == ReidlineInputMethod and history.last&.end_with?("\\") @@ -107,7 +107,7 @@ module IRB raise end - open(history_file, 'w', 0600 ) do |f| + open(history_file, "w:#{IRB.conf[:LC_MESSAGES].encoding}", 0600) do |f| hist = history.map{ |l| l.split("\n").join("\\\n") } f.puts(hist[-num..-1] || hist) end -- cgit v1.2.3