aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataImport.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-01-06 01:58:16 +0000
committerrowanbeentje <rowan@beent.je>2012-01-06 01:58:16 +0000
commitf50a951609470af0cfb080b3932da899a3880502 (patch)
tree5f16a6532133fbf499838101b8aa0f69e299f826 /Source/SPDataImport.m
parentef58dcc476f4732f3b3baa32486c8be504bbd242 (diff)
downloadsequelpro-f50a951609470af0cfb080b3932da899a3880502.tar.gz
sequelpro-f50a951609470af0cfb080b3932da899a3880502.tar.bz2
sequelpro-f50a951609470af0cfb080b3932da899a3880502.zip
- 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
Diffstat (limited to 'Source/SPDataImport.m')
-rw-r--r--Source/SPDataImport.m7
1 files changed, 6 insertions, 1 deletions
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];