PapaParse
PapaParse copied to clipboard
Issue with quoted text
Hi! I've found an issue when the field has a quoted text:
csv:
stop_id,stop_code,stop_name,stop_lat,stop_lon,zone_id,location_type
e145a981-7131-463e-8a88-2d29a52c4a75,060320,Crater Lake Hwy - North of Vilas Rd,42.390016,-122.855824,1,0
384f81ea-2af8-4283-bf74-6efdee28b116,030250,"C" St - West of 4th St,42.31462,-122.9667,1,0
b119acb3-a34c-423b-983f-19d8fdc925c6,240240,E Barnett Rd - West of Crestbrook Rd,42.316523,-122.841582,1,0
result:
{
stop_id: 'e145a981-7131-463e-8a88-2d29a52c4a75',
stop_code: '060320',
stop_name: 'Crater Lake Hwy - North of Vilas Rd',
stop_lat: '42.390016',
stop_lon: '-122.855824',
zone_id: '1',
location_type: '0'
}
{
stop_id: '384f81ea-2af8-4283-bf74-6efdee28b116',
stop_code: '030250',
stop_name: 'C" St - West of 4th St,42.31462,-122.9667,1,0\n' +
'b119acb3-a34c-423b-983f-19d8fdc925c6,240240,E Barnett Rd - West of Crestbrook Rd,42.316523,-122.841582,1,0\n'
}
Papaparse v 5.1.0
Any ideas?
Technically this is invalid CSV since the field is not quoted. But this is a common issue. I mentioned it in #748 as an example of a good future plugin.
I also just ran into this issue. Any work around for this?
Also @dboskovic can I ask why you think this is technically invalid CSV? I mean it is still Comma-Separated Values, it's just the value contains double quotes. And based on my testing the issue only happens if the value starts with double quotes. If the double quotes are in middle of the string it parses fine