@@ -9,6 +9,8 @@ extension CSVReader {
99 public var headerStrategy : Strategy . Header
1010 /// Trims the given characters at the beginning and end of each row, and between fields.
1111 public var trimStrategry : CharacterSet
12+ /// The strategy for escaping quoted fields.
13+ public var escapingStrategy : Strategy . Escaping
1214 /// The encoding used to identify the underlying data or `nil` if you want the CSV reader to try to figure it out.
1315 ///
1416 /// If no encoding is provided and the input data doesn't contain a Byte Order Marker (BOM), UTF8 is presumed.
@@ -24,6 +26,7 @@ extension CSVReader {
2426 self . delimiters = ( field: " , " , row: " \n " )
2527 self . headerStrategy = . none
2628 self . trimStrategry = . init( )
29+ self . escapingStrategy = . doubleQuote
2730 self . encoding = nil
2831 self . presample = false
2932 }
@@ -38,7 +41,7 @@ extension CSVReader {
3841 /// The characters set to be trimmed at the beginning and ending of each field.
3942 let trimCharacters : CharacterSet
4043 /// The unicode scalar used as encapsulator and escaping character (when printed two times).
41- let escapingScalar : Unicode . Scalar ? = " \" "
44+ let escapingScalar : Unicode . Scalar ?
4245
4346 /// Creates the inmutable reader settings from the user provided configuration values.
4447 /// - parameter configuration: The configuration values provided by the API user.
@@ -61,6 +64,8 @@ extension CSVReader {
6164 }
6265 // 2. Set the trim characters set.
6366 self . trimCharacters = configuration. trimStrategry
67+ // 3. Set the escaping scalar.
68+ self . escapingScalar = configuration. escapingStrategy. scalar
6469 }
6570 }
6671}
0 commit comments