[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CSV] Inconsistent record separator behavior


we have this strange handling of record separator / line endings in CSV:

Users can use what ever character sequence they like as a record separator.
I could for example use the ! character to mark the end of a record.
Then we have CSVPrinter.printComment(String). This inserts comments into a
CSV output. It detects CRLF and call println() on the CSVFormat, which in
turn uses the record separator to indicate a new record...

So now I'm thinking: Does it make sense to use anything else but LF or CRLF
as record separator? Maybe we should deprecate
CSVFormat.recordSeparator(String) and introduce a LineEnding enum where
users can choose between LF and CRLF. This way we can make the behavior
between parsing and printing consistent.