Merge pull request #659 - closes #659

This commit is contained in:
Tom Morris 2013-03-18 21:24:01 -04:00
commit bfa7c34d17
2 changed files with 4 additions and 2 deletions

View File

@ -81,6 +81,7 @@ public class CsvExporter implements WriterExporter{
JSONUtilities.getString(options, "separator", Character.toString(this.separator)); JSONUtilities.getString(options, "separator", Character.toString(this.separator));
final String lineSeparator = options == null ? CSVWriter.DEFAULT_LINE_END : final String lineSeparator = options == null ? CSVWriter.DEFAULT_LINE_END :
JSONUtilities.getString(options, "lineSeparator", CSVWriter.DEFAULT_LINE_END); JSONUtilities.getString(options, "lineSeparator", CSVWriter.DEFAULT_LINE_END);
final boolean quoteAll = options == null ? false : JSONUtilities.getBoolean(options, "quoteAll", false);
final boolean printColumnHeader = final boolean printColumnHeader =
(params != null && params.getProperty("printColumnHeader") != null) ? (params != null && params.getProperty("printColumnHeader") != null) ?
@ -110,7 +111,7 @@ public class CsvExporter implements WriterExporter{
cellData.text : cellData.text :
""; "";
} }
csvWriter.writeNext(strings, false); csvWriter.writeNext(strings, quoteAll);
} }
} }
}; };

View File

@ -96,12 +96,13 @@ public class SeparatorBasedImporter extends TabularImportingParserBase {
} }
sep = StringEscapeUtils.unescapeJava(sep); sep = StringEscapeUtils.unescapeJava(sep);
boolean processQuotes = JSONUtilities.getBoolean(options, "processQuotes", true); boolean processQuotes = JSONUtilities.getBoolean(options, "processQuotes", true);
boolean strictQuotes = JSONUtilities.getBoolean(options, "strictQuotes", false);
final CSVParser parser = new CSVParser( final CSVParser parser = new CSVParser(
sep.toCharArray()[0],//HACK changing string to char - won't work for multi-char separators. sep.toCharArray()[0],//HACK changing string to char - won't work for multi-char separators.
CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_QUOTE_CHARACTER,
(char) 127, // we don't want escape processing try DEL as a rare character until we can turn it off (char) 127, // we don't want escape processing try DEL as a rare character until we can turn it off
CSVParser.DEFAULT_STRICT_QUOTES, strictQuotes,
CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE,
!processQuotes); !processQuotes);