CSV.read Illegal quoting in line x

后端 未结 5 923
深忆病人
深忆病人 2020-12-08 04:16

I am using ruby CSV.read with massive data. From time to time the library encounters poorly formatted lines, for instance:

\"Illegal quoting in line 53657.\"         


        
5条回答
  •  心在旅途
    2020-12-08 04:59

    Try forcing double quote character " as quote char:

    require 'csv'
    CSV.foreach(file,{headers: :first_row, quote_char: "\x00"}) do |line|
      p line
    end
    

提交回复
热议问题