You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the default config, how can I escape commas and line returns within a field in order to ensure the resulting CSV is readable?
Additional Context
I'm hacking together an app with Swift and Xcode and I'm a complete novice. To provide the app with some basic data I have provided it with csv files, which are parsed with CodableCSV. Many thanks for the package!
Using basic data it's working fine. I have tried not to fiddle with the configuration. Delimiters are commas and end of line is "\r".
However, for one of my tables I need now to expand one of the fields to include sentences or even paragraphs of text, which contain commas and newlines. Initially I understood from the documentation that the way to do this is to enclose the whole field in double quotes ("..."). That crashed the app and so did escaping the individual offending characters with double quotes (",) or with a backslash (,).
Many thanks for any pointers!
Example extract of table:
id,title,introduction
reg,Regular Models,"The good news for learners of Spanish..."
irr_i,Essentials I,
irr_ii,Essentials II,
Error message:
CodableCSV/Reader.swift:75:` Fatal error: 'try!' expression unexpectedly raised an error: [CSVReader] Invalid input
Reason: The targeted field parsed successfully. However, the character right after it was not a field nor row delimiter.
Help: If your CSV is CRLF, change the row delimiter to "\r\n" or add a trim strategy for "\r".
User info: Row index: 1, Field: The good news for learners of `Spanish...
System
OS: macOS 12.3
CodableCSV: 0.6.7
Xcode 13
The text was updated successfully, but these errors were encountered:
Question
With the default config, how can I escape commas and line returns within a field in order to ensure the resulting CSV is readable?
Additional Context
I'm hacking together an app with Swift and Xcode and I'm a complete novice. To provide the app with some basic data I have provided it with csv files, which are parsed with CodableCSV. Many thanks for the package!
Using basic data it's working fine. I have tried not to fiddle with the configuration. Delimiters are commas and end of line is "\r".
However, for one of my tables I need now to expand one of the fields to include sentences or even paragraphs of text, which contain commas and newlines. Initially I understood from the documentation that the way to do this is to enclose the whole field in double quotes ("..."). That crashed the app and so did escaping the individual offending characters with double quotes (",) or with a backslash (,).
Many thanks for any pointers!
Example extract of table:
id,title,introduction
reg,Regular Models,"The good news for learners of Spanish..."
irr_i,Essentials I,
irr_ii,Essentials II,
Error message:
System
The text was updated successfully, but these errors were encountered: