FasterCSV - 在不应该的情况下引发 MalformedCSVError
示例数据:
"iWine","Barcode","Location","Bin","Size","Valuation","Price","StoreName",\ "购买日期","备注","年份","葡萄酒","区域设置","国家","地区","次区域",\ "名称","生产者","排序生产者","类型","颜色","类别","品种",\ “MasterVarietal”、“名称”、“葡萄园”、“WA”、“WS”、“IWC”、“BG”、“WE”、“JR”、\ "RH","JG","GV","JK","LD","CW","CT","MY","BeginConsume","EndConsume"
"334142", "15240542","地窖","","750ml","","0","","","","2003",\
"Bodegas y Viñedos Alión Ribera del Duero","西班牙,卡斯蒂利亚莱昂,杜罗河岸","西班牙",\
“卡斯蒂利亚和莱昂”、“未知”、“Ribera del Duero”、“Bodegas y Viñedos Alión”、\
“Alión,Bodegas y Viñedos”,“红”,“红”,“干”,“丹魄”,“丹魄”,“未知”,“未知”,\
""、""、""、""、""、""、""、""、""、""、""、""、"91.3333333333333"、""、"2011"、"2021" 抛出
FasterCSV 坚持在解析此数据时引发 MalformedCSVError,特别是在 fast_csv.rb 中的第 1616 行附近
raise MalformedCSVError unless in_quotes
Sample data:
"iWine","Barcode","Location","Bin","Size","Valuation","Price","StoreName",\
"PurchaseDate","Note","Vintage","Wine","Locale","Country","Region","SubRegion",\
"Appellation","Producer","SortProducer","Type","Color","Category","Varietal",\
"MasterVarietal","Designation","Vineyard","WA","WS","IWC","BG","WE","JR",\
"RH","JG","GV","JK","LD","CW","CT","MY","BeginConsume","EndConsume"
"334142","15240542","Cellar","","750ml","","0","","","","2003",\
"Bodegas y Viñedos Alión Ribera del Duero","Spain, Castilla y León, Ribera del Duero","Spain",\
"Castilla y León","Unknown","Ribera del Duero","Bodegas y Viñedos Alión",\
"Alión, Bodegas y Viñedos","Red","Red","Dry","Tempranillo","Tempranillo","Unknown","Unknown",\
"","","","","","","","","","","","","91.3333333333333","","2011","2021"
FasterCSV insists on raising MalformedCSVError when parsing this data, specifically thrown around line 1616 in faster_csv.rb
raise MalformedCSVError unless in_quotes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另外 - 您是否查看了有关编码的相关帖子?
如何使用 FasterCSV 导入名称为“Ciarán”的行?
Also - did you check out related posts about the encoding?
How do I import using FasterCSV a row with a name like "Ciarán"?
我猜您遇到的问题是由于非 ASCII 字符造成的。
尝试用非重音符号替换它们,看看是否有效。如果是这样,您必须使用 FasterCSV 上的 :encoding 选项来匹配您的文件格式。
I'd guess that the issues you are having are due to the non-ascii characters.
Try replacing them with non-accents, and see if it works. If it does, you must use the :encoding option on FasterCSV to match your file's format.