Closed davideluque closed 4 years ago
CSV.foreach("file.csv", "r:bom|utf-8", headers: true) {}
will work.
CSV.foreach("file.csv", "r:bom|utf-8", headers: true) {}
will work.
@kou Thanks for your response. I tried your suggestion and I get an error
ArgumentError: wrong number of arguments (given 3, expected 1..2) from /home/david/.rbenv/versions/2.4.2/lib/ruby/2.4.0/csv.rb:1145:in `foreach'
Could you re-open my issue, please?
gem install csv
will work.
gem install csv
will work.
Thanks, it does. Also gem 'csv'
in gemfile.
I am trying to iterate over a CSV that has a byte order mark (BOM) and headers.
Does the trick to address the byte order mark.
Works to take the headers into consideration.
I can't find a way to combine both options.
Ruby version: 2.4.2