RFC-4180, paragraph "If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote." –
tommed
Feb 18, 2015 at 16:35
5
As tommed says you only need to add a single double quote to escape a double quote. You can use a command-line tool called csvfix to detect any lines which don't conform: csvfix check -nl -v [filename] –
Sam Critchley
Jun 30, 2016 at 14:51
4
@SamCritchley I only see a single double quote being used to escape here. By "Use 2 quotes", user4035 means that 1 quote should be replaced with 2 quotes. By escaping double quotes with double quotes, you're effectively creating pairs of double quotes (2 double quotes). The final quote you see on the end is to terminate the field. –
Zenexer
Sep 9, 2016 at 3:11
Really nice approach. But this requires me to modify the CSV file before parsing. –
remy727
Sep 20, 2020 at 15:43
1
@GarfieldCat Try this: "world,"",hello" –
user4035
Dec 27, 2020 at 9:54