From f50a951609470af0cfb080b3932da899a3880502 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Fri, 6 Jan 2012 01:58:16 +0000 Subject: - Add a new CSV import field escape setting, as a new default, supporting both backslash and double-character escaping. This will mean the vast majroty of CSVs selected for import will be read correctly by default, fixing issues such as Issue #1252 --- Source/SPDataImport.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Source/SPDataImport.m') diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index ef92996a..b3d19f11 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -811,7 +811,12 @@ [csvParser setFieldTerminatorString:[importFieldsTerminatedField stringValue] convertDisplayStrings:YES]; [csvParser setLineTerminatorString:[importLinesTerminatedField stringValue] convertDisplayStrings:YES]; [csvParser setFieldQuoteString:[importFieldsEnclosedField stringValue] convertDisplayStrings:YES]; - [csvParser setEscapeString:[importFieldsEscapedField stringValue] convertDisplayStrings:YES]; + if ([[importFieldsEscapedField stringValue] isEqualToString:@"\\ or \""]) { + [csvParser setEscapeString:@"\\" convertDisplayStrings:NO]; + } else { + [csvParser setEscapeString:[importFieldsEscapedField stringValue] convertDisplayStrings:YES]; + [csvParser setEscapeStringsAreMatchedStrictly:YES]; + } [csvParser setNullReplacementString:[prefs objectForKey:SPNullValue]]; csvDataBuffer = [[NSMutableData alloc] init]; -- cgit v1.2.3