Skip to content

Commit c7f90f9

Browse files
committed
Changed the default line separator to \r\n to comply with RFC 4180 (SANDBOX-163)
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1201115 13f79535-47bb-0310-9956-ffa450edef68
1 parent 70337be commit c7f90f9

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class CSVFormat implements Cloneable, Serializable {
3434
private boolean trailingSpacesIgnored = true;
3535
private boolean unicodeEscapesInterpreted = false;
3636
private boolean emptyLinesIgnored = true;
37-
private String lineSeparator = "\n";
37+
private String lineSeparator = "\r\n";
3838

3939

4040
/**
@@ -45,7 +45,7 @@ public class CSVFormat implements Cloneable, Serializable {
4545
*/
4646
public static final char DISABLED = '\ufffe';
4747

48-
/** Standard comma separated format. */
48+
/** Standard comma separated format as defined by RFC 4180. */
4949
public static final CSVFormat DEFAULT = new CSVFormat(',', '"', DISABLED, DISABLED, true, true, false, true);
5050

5151
/** Excel file format (using a comma as the value delimiter). */

src/test/java/org/apache/commons/csv/CSVFormatTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public void testImmutalibity() {
3737
assertEquals('!', format.getDelimiter());
3838
assertEquals('!', format.getEncapsulator());
3939
assertEquals('!', format.getCommentStart());
40-
assertEquals("\n", format.getLineSeparator());
4140
assertEquals('!', format.getEscape());
41+
assertEquals("\r\n", format.getLineSeparator());
4242

4343
assertEquals(true, format.isLeadingSpacesIgnored());
4444
assertEquals(true, format.isTrailingSpacesIgnored());

src/test/java/org/apache/commons/csv/CSVPrinterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class CSVPrinterTest extends TestCase {
3030

31-
String lineSeparator = "\n";
31+
String lineSeparator = "\r\n";
3232

3333
public void testPrinter1() throws IOException {
3434
StringWriter sw = new StringWriter();

0 commit comments

Comments
 (0)