Commit d6efc4b
committed
Escape nested quote with an additional quote
According to RFC 4180 the proper way to escape double-quotes in CSV data
is to prepend an additional double-quote character:
> 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.
Currently we escape double-quotes using a backslash. Opening such a file
in Microsoft Excel and/or Apple Numbers breaks the column layout, i.e.
the value containing the double quote is interpretted as multiple
columns instead of one. On the contrary, escaping using an extra
double-quote preserves the expected column layout in both Microsoft
Excel and Apple Numbers.
See also:
- https://tools.ietf.org/html/rfc41801 parent f76048b commit d6efc4b
File tree
3 files changed
+3
-4
lines changed- lib
- test/CSV/quoted
3 files changed
+3
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | | - | |
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
0 commit comments