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
This commit is contained in:
Emmanuel Bourg 2011-11-12 00:16:56 +00:00
parent 70337bef8f
commit c7f90f93c6
3 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,7 @@ public class CSVFormat implements Cloneable, Serializable {
private boolean trailingSpacesIgnored = true;
private boolean unicodeEscapesInterpreted = false;
private boolean emptyLinesIgnored = true;
private String lineSeparator = "\n";
private String lineSeparator = "\r\n";
/**
@ -45,7 +45,7 @@ public class CSVFormat implements Cloneable, Serializable {
*/
public static final char DISABLED = '\ufffe';
/** Standard comma separated format. */
/** Standard comma separated format as defined by RFC 4180. */
public static final CSVFormat DEFAULT = new CSVFormat(',', '"', DISABLED, DISABLED, true, true, false, true);
/** Excel file format (using a comma as the value delimiter). */

View File

@ -37,8 +37,8 @@ public class CSVFormatTest extends TestCase {
assertEquals('!', format.getDelimiter());
assertEquals('!', format.getEncapsulator());
assertEquals('!', format.getCommentStart());
assertEquals("\n", format.getLineSeparator());
assertEquals('!', format.getEscape());
assertEquals("\r\n", format.getLineSeparator());
assertEquals(true, format.isLeadingSpacesIgnored());
assertEquals(true, format.isTrailingSpacesIgnored());

View File

@ -28,7 +28,7 @@ import junit.framework.TestCase;
*/
public class CSVPrinterTest extends TestCase {
String lineSeparator = "\n";
String lineSeparator = "\r\n";
public void testPrinter1() throws IOException {
StringWriter sw = new StringWriter();