diff options
author | rowanbeentje <rowan@beent.je> | 2010-01-22 00:28:38 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-01-22 00:28:38 +0000 |
commit | aea4d46d121e30285014bf70aa277b140e0fd16d (patch) | |
tree | b4f0fc2738b94d15fa629f8ec62b201fd83dbcbf | |
parent | 2080300649b3d4f68a0aac0a72dcb6479a3cba13 (diff) | |
download | sequelpro-aea4d46d121e30285014bf70aa277b140e0fd16d.tar.gz sequelpro-aea4d46d121e30285014bf70aa277b140e0fd16d.tar.bz2 sequelpro-aea4d46d121e30285014bf70aa277b140e0fd16d.zip |
- When exporting CSVs containing linebreaks, no longer escape those linebreaks if they are within a quoted cell, improving compatibility with other applications (notably Excel)
-rw-r--r-- | Source/TableDump.m | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m index e555786b..15a8c344 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -2128,20 +2128,18 @@ options:NSLiteralSearch range:NSMakeRange(0, [csvCellString length])]; } - - // Escape occurrences of the line end character - [csvCellString replaceOccurrencesOfString:lineEndString - withString:escapedLineEndString - options:NSLiteralSearch - range:NSMakeRange(0, [csvCellString length])]; // If the string isn't quoted or otherwise enclosed, escape occurrences of the - // field separators + // field separators and line end character if ( quoteFieldSeparators || csvCellIsNumeric ) { [csvCellString replaceOccurrencesOfString:fieldSeparatorString withString:escapedFieldSeparatorString options:NSLiteralSearch range:NSMakeRange(0, [csvCellString length])]; + [csvCellString replaceOccurrencesOfString:lineEndString + withString:escapedLineEndString + options:NSLiteralSearch + range:NSMakeRange(0, [csvCellString length])]; } // Write out the cell data by appending strings - this is significantly faster than stringWithFormat. |