diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index 55c77b8f..23157967 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -29,6 +29,8 @@ import java.io.StringWriter; */ public class CSVFormat implements Serializable { + /** According to RFC 4180, line breaks are delimited by CRLF */ + private static final String CRLF = "\r\n"; private final char delimiter; private final char encapsulator; private final char commentStart; @@ -49,7 +51,7 @@ public class CSVFormat implements Serializable { static final char DISABLED = '\ufffe'; /** Standard comma separated format as defined by RFC 4180. */ - public static final CSVFormat DEFAULT = new CSVFormat(',', '"', DISABLED, DISABLED, true, true, false, true, "\r\n"); + public static final CSVFormat DEFAULT = new CSVFormat(',', '"', DISABLED, DISABLED, true, true, false, true, CRLF); /** * Excel file format (using a comma as the value delimiter). @@ -62,10 +64,10 @@ public class CSVFormat implements Serializable { * *
CSVFormat fmt = CSVFormat.EXCEL.withDelimiter(';');
*/ - public static final CSVFormat EXCEL = new CSVFormat(',', '"', DISABLED, DISABLED, false, false, false, false, "\r\n"); + public static final CSVFormat EXCEL = new CSVFormat(',', '"', DISABLED, DISABLED, false, false, false, false, CRLF); /** Tab-delimited format, with quote; leading and trailing spaces ignored. */ - public static final CSVFormat TDF = new CSVFormat('\t', '"', DISABLED, DISABLED, true, true, false, true, "\r\n"); + public static final CSVFormat TDF = new CSVFormat('\t', '"', DISABLED, DISABLED, true, true, false, true, CRLF); /** * Default MySQL format used by the SELECT INTO OUTFILE and