FasterCSV - 在不应该的情况下引发 MalformedCSVError

发布于 2024-08-03 11:45:18 字数 842 浏览 4 评论 0原文

示例数据:

"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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

意犹 2024-08-10 11:45:18

另外 - 您是否查看了有关编码的相关帖子?

如何使用 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"?

小ぇ时光︴ 2024-08-10 11:45:18

我猜您遇到的问题是由于非 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文