skelpo / CSV

A simple CSV file parser and serializer

Home Page:http://www.skelpo.codes/CSV/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Escaped Quotes Dropping Characters

dashadrick opened this issue · comments

Characters are lost when parsing a slightly modified version of your test data:

let data = """ first name,last_name,age,gender,tagLine TinTin,,16,M,"=HYPERLINK(""https://en.wikipedia.org/wiki/The_Great_Snake"",""Great snakes!"")" """

CSV produces the following when processing the last field:
Source:
=HYPERLINK(""https://en.wikipedia.org/wiki/The_Great_Snake"",""Great snakes!"")
Parsed Result:
=HYPERLINK("https://en.wikipedia.org/wiki/The_Great_Snak""Great snakes"

its missing the 'e' in Snake, the ',' after Snake", the '!' and the '")" at the end:

I updated the cellDelimiter processing line 128 in Parser.swift with the following:

case true: index += 1; slice.end += 1

The test that failed with the above data now passes and with an update of the test data all your other tests pass as well.