Add feature to ignore surrounding spaces
dportabella opened this issue · 2 comments
dportabella commented
I have this input: aa, "bb,cc", dd
and I expect this list:
aa
bb,cc
dd
Using the DefaultCSVFormat
, this input fails with MalformedCSVException
.
using this formatter:
implicit object MyFormat extends DefaultCSVFormat {
override val escapeChar = '\\'
}
then I get this list:
aa
"bb
cc"
dd
so, the parsing is invalid when a delimiter is inside a quote.
also, it should ignore spaces between fields.
dportabella commented
Note: the previous example works as expected using the apache commons CSV parser:
org.apache.commons.csv.CSVParser.parse(
new File(file),
StandardCharsets.UTF_8,
CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true))
devmanhinton commented
+1 On this