diff options
Diffstat (limited to 'Source/SPCSVExporter.m')
-rw-r--r-- | Source/SPCSVExporter.m | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m index b465b4e2..49d6ade6 100644 --- a/Source/SPCSVExporter.m +++ b/Source/SPCSVExporter.m @@ -330,18 +330,16 @@ range:NSMakeRange(0, [csvCellString length])]; } - // Escape occurrences of the line end character - [csvCellString replaceOccurrencesOfString:[self csvLineEndingString] - withString:escapedLineEndString - options:NSLiteralSearch - range:NSMakeRange(0, [csvCellString length])]; - - // If the string isn't quoted or otherwise enclosed, escape occurrences of the field separators + // If the string isn't quoted or otherwise enclosed, escape occurrences of the field separators and line end character if (quoteFieldSeparators || csvCellIsNumeric) { [csvCellString replaceOccurrencesOfString:[self csvFieldSeparatorString] withString:escapedFieldSeparatorString options:NSLiteralSearch range:NSMakeRange(0, [csvCellString length])]; + [csvCellString replaceOccurrencesOfString:[self csvLineEndingString] + withString:escapedLineEndString + options:NSLiteralSearch + range:NSMakeRange(0, [csvCellString length])]; } // Write out the cell data by appending strings - this is significantly faster than stringWithFormat. |