Skip to content

Instantly share code, notes, and snippets.

@koshigoe
Created March 26, 2019 00:37
Show Gist options
  • Save koshigoe/bae5eede78dc61212b1ba4a6e5e73604 to your computer and use it in GitHub Desktop.
Save koshigoe/bae5eede78dc61212b1ba4a6e5e73604 to your computer and use it in GitHub Desktop.
require 'csv'
puts CSV::VERSION
File.open('test.csv', 'wb') do |f|
100.times { f.puts('あ' * 1_024) }
5.times { f.puts 'a' }
f.write("Invalid Byte Sequence in UTF-8 \x90")
end
CSV.foreach('test.csv') { |_| }
__END__
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
3.0.5
...
.../csv-3.0.5/lib/csv/parser.rb:277:in `rescue in parse': Invalid byte sequence in UTF-8 in line 99. (CSV::MalformedCSVError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment