Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to ignore surrounding spaces #91

Open
dportabella opened this issue Sep 28, 2016 · 2 comments
Open

Add feature to ignore surrounding spaces #91

dportabella opened this issue Sep 28, 2016 · 2 comments

Comments

@dportabella
Copy link

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
Copy link
Author

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))

@tototoshi tototoshi changed the title invalid parsing when a delimiter is inside a quote Add feature to ignore surrounding spaces Feb 27, 2017
@devmanhinton
Copy link

+1 On this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants