Tom, I've just had a quick look at the code for parsing the csv input in GnuCash. It uses the C++ boost library tokenizer method to break up an input CSV line into the fields. The boost tokenizer apparently doesn't handle backslashes or double quotes well so GnuCash does a bit of preprocessing on the line before passing it to the boost tokenizer. That preprocessing for backslashes consists of if a single backslash occurs in the input line it makes it a double backslash by inserting another backslash following it unless the following character is already a backslash as the standard C++ string processing used in boost's tokenizer requires backslashes to be escaped to be interpreted as a backslash within the token.
I'm currently locked out of bugzilla with I think an expired password as its been a few years since I accessed it so I can't access any bug reports there until I am granted access again. If you can send me an example of a BoA line which is causing the problem Imay be able to work out what the problem is. On Mon, 2026-06-08 at 09:31 -0400, Tom Teixeira wrote: > If you do a web search for csv files and backslash, you will see that > this has been a contentious issue for many software products, with > many > telling their users that they _have_ to preprocess the input if they > want backslash to appear in any location in a data field. Others -- > like > Microsoft Excel -- never give special treatment to backslash and have > no > option to do so. > > A solution I would be happy with is something that disabled special > handling for backslash. I don't know whether being able to choose a > different escape character. A quick google search says "For more > specific configurations, tools like the Python CSV module allow you > to > manually define any character as the quotechar or escapechar > depending > on your data needs." The boost library that Gnucash uses does allow > specifying zero or more characters to treat as escape characters. > > On 6/8/26 6:59 AM, Fred Bone wrote: > > On 08 June 2026 at 6:32, Tom Teixeira said: > > > > > And I repeat that the file produced by BoA is read as is by > > > Microsoft > > > Excel and LibreOffice and many other popular spreadsheet > > > programs, without > > > preprocessing. > > The question is, read how? > > > > When I save the 3 sample lines verbatim into a file with filetype > > ".csv", > > and open it in LibreOffice, the result is that the backslashes are > > read > > verbatim. So it is NOT treating them as escape characters. > > > > An old copy of Lotus 1-2-3 does the same. > > > > Google Sheets does the same if I "upload" the same file. > > > > I don't have "many other popular spreadsheet programs" to test > > with. > > > > Gnucash appears to treat backslashes unconditionally as escape > > characters, which it seems to me is the source of the problem. On > > the > > other hand, reportedly other data sources do use backslashes as > > escapes > > (which is presumably why Gnucash so treats them). > > _______________________________________________ > > gnucash-user mailing list > > [email protected] > > To update your subscription preferences or to unsubscribe: > > https://lists.gnucash.org/mailman/listinfo/gnucash-user > > ----- > > Please remember to CC this list on all your replies. > > You can do this by using Reply-To-List or Reply-All. > > > _______________________________________________ > gnucash-user mailing list > [email protected] > To update your subscription preferences or to unsubscribe: > https://lists.gnucash.org/mailman/listinfo/gnucash-user > ----- > Please remember to CC this list on all your replies. > You can do this by using Reply-To-List or Reply-All. -- David Cousens _______________________________________________ gnucash-user mailing list [email protected] To update your subscription preferences or to unsubscribe: https://lists.gnucash.org/mailman/listinfo/gnucash-user ----- Please remember to CC this list on all your replies. You can do this by using Reply-To-List or Reply-All.
