我发现了 FasterCSV (1.5.0) 的 CSV 解析问题,这似乎是一个真正的错误,但我希望有一个解决方法。
基本上,当字段用引号引起来时,在分隔符(在我的情况下是逗号)之后添加一个空格会生成一个MalformedCSVError
.
这是一个简单的例子:
# No quotes on fields -- works fine
FasterCSV.parse_line("one,two,three")
=> ["one", "two", "three"]
# Quotes around fields with no spaces after separators -- works fine
FasterCSV.parse_line("\"one\",\"two\",\"three\"")
=> ["one", "two", "three"]
# Quotes around fields but with a space after the first separator -- fails!
FasterCSV.parse_line("\"one\", \"two\",\"three\"")
=> FasterCSV::MalformedCSVError: Illegal quoting on line 1.
我要疯了,还是 FasterCSV 中的错误?