I use for reading * .CSV file

<dependency> <groupId>net.sourceforge.javacsv</groupId> <artifactId>javacsv</artifactId> <version>2.0</version> </dependency> 

There is a file with transitions to another line. for example

 CODE DESCRIPTION AA "Эта запись содержит: - строку один; - строку два; - строку три." 

Is it possible to read such a file using this or any other library?

  • JavaCSV should be able to read by default, since the CSV standard stipulates that if a value contains a line break, then it must be enclosed in quotes. The CSV you quoted is compliant. Did you have a problem with this library? - andreycha
  • From the example above, 4 entries are obtained ... In the last three CODE = NULL - Argos

1 answer 1

According to Wikipedia, each row of the file is one row of the table! Try to replace the new line breaks with "\ n".

  • From the same Wikipedia: "Values ​​containing reserved characters (double quote, comma, semicolon, new line) are framed with double quotes (") " - andreycha
  • I suggest that the character \ n (if it is the value of the field) should be framed in quotes. That is, you can not use the code: CODE DESCRIPTION AA, \n - psih747
  • @ psih747, replace new line breaks? It would help if I compiled these * .CSV files and downloaded them. Easier in this case to change JavaCSV a bit ... - Argos
  • @Argos, I advise you to try commons-csv . Choose your format, for example TDF and, I hope, I will succeed. - psih747