public
Created

  • Download Gist
test.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# encoding: shift_jis
 
require 'yaml'
require 'tempfile'
 
t = Tempfile.new(['shiftjis', 'yml'], :encoding => 'SHIFT_JIS')
t.write '--- こんにちは!'
t.close
 
# If the external encoding isn't utf8, utf16le, or utf16be, we cannot
# process the file.
File.open(t.path, 'r', :encoding => 'SHIFT_JIS') do |f|
YAML.load(f) # ArgumentError が例外発生する
end
 
t.close(true)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.