Apache OpenOffice (AOO) Bugzilla – Issue 94700
CSV import chokes on an escaped " character
Last modified: 2022-12-27 13:38:28 UTC
When opening a CSV file in Calc (fields enclosed by '"', terminated by ',' and escaped by '\'), any field containing a single escaped '"' character results in that line and all following lines being dropped.
Created attachment 57032 [details] An example document illustrating the problem described
As far as I know, there exists no "escaping". You have to double the text delimiter, if it is part of your text. Your example would look "testing","testing","testing" "testing","testing","testing" "testing","test""ing","testing" "testing","testing","testing"
Researching this further, it seems that there is some disagreement amongst CSV supporting applications as to whether '\' can be used as an escape character. Certainly, the application generating the CSV files that first caused me to notice the problem considers the backslash as a legitimate escape character. Given that there was no official standard prior to RFC4180, and a number of alternative representations have already gained widespread adoption, should OO not provide some level of support for these alternative representations even if they're not strictly correct? Failing that, perhaps a more extensive entry in the help files describing the problem I encountered? Incidentally, I'm fairly certain that Office 2007 (and possibly earlier versions) handles the backslash escape character 'correctly'. It may be worth making the OO CSV import more forgiving purely for the sake of greater compatibility - or at least perceived compatibility - with MS Office.
I change this to an enhancement request and hope you agree. Request: Make OpenOffice.org capable of using escape characters in import of csv (and I add it) and txt files.
Yes, I think you're right, it is an enhancement of sorts.
It transpires that the application I was exporting the troublesome CSV file from, is actually following a format required by MySQL's 'LOAD DATA INFILE'. http://dev.mysql.com/doc/refman/5.0/en/load-data.html
We already support backslashes as escapes in SvStream::ReadCsvLine(), but the calling code never enables that nor would process the results further.