Skip to content

Instantly share code, notes, and snippets.

@solars
Created May 11, 2016 09:16
Show Gist options
  • Save solars/acc08689df33e26c2882039b33f0cc68 to your computer and use it in GitHub Desktop.
Save solars/acc08689df33e26c2882039b33f0cc68 to your computer and use it in GitHub Desktop.
content = File.read("/home/solars/tmp/trivagocsvs/618_Hotel_report_20160405.csv")
=> "\"one\";\"two\"\ntest;bar\n"
CSV.parse(content, col_sep: ';', headers: true)
=> CSV::MalformedCSVError: Illegal quoting in line 1.
=> from /home/solars/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/csv.rb:1874:in `block (2 levels) in shift'
str = "\"one\";\"two\"\ntest;bar\n"
CSV.parse(str, col_sep: ';')
=> works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment