diff options
author | aycabta <aycabta@gmail.com> | 2020-01-14 15:40:03 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-01-14 15:40:38 +0900 |
commit | 8c3efa494091e6e0001f4a708fb7568c242387b9 (patch) | |
tree | ce5139b24592634e2870819e3a20974466afc5d4 /lib/irb/ext/save-history.rb | |
parent | a2638c0d87106c6ba023a321eea502f35131753e (diff) |
Use Reline.encoding_system_needs if exists
Diffstat (limited to 'lib/irb/ext/save-history.rb')
-rw-r--r-- | lib/irb/ext/save-history.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 |