mholt/PapaParse

Missing quotes when parsing.

オープン

#712 opened on 2019/10/02

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (1,185 件のフォーク)batch import
help wanted

Repository metrics

Stars
 (13,546 個のスター)
PR merge metrics
 (平均マージ 18h) (30d で 1 merged PR)

説明

I've got the following two pieces of data in Excel:

Hi - need the forecasting documents for ColorTokens- they do not have a master payer, but want to do an EDP. Not sure if they need the master payer to do the EPD. Here are their IDs: 096742272934 070181106296 244882251506 602341081844 664991688287 681262709514 816618564346 822256776645 Deferred to CE Cost Optimization

and

"This is" is not a movie"

When you copy this data from Excel, it wraps the first big block in quotes and this is the string data I see:

"Hi - need the forecasting documents for ColorTokens- they do not have a master payer, but want to do an EDP. Not sure if they need the master payer to do the EPD.

Here are their IDs: 096742272934 070181106296 244882251506 602341081844 664991688287 681262709514 816618564346 822256776645

Deferred to CE Cost Optimization" "This is" is not a movie"

JSON.stringify shows this: ""Hi - need the forecasting documents for ColorTokens- they do not have a master payer, but want to do an EDP. Not sure if they need the master payer to do the EPD. \n\nHere are their IDs: \n096742272934\n070181106296\n244882251506\n602341081844\n664991688287\n681262709514\n816618564346\n822256776645\n\nDeferred to CE Cost Optimization"\t"This is" is not a movie""

The issue is when I take this data and run it through Papaparse like such: Papa.parse(data, { delimiter: "\t" }), the surrounding quotes are dropped.

This makes sense for the larger block of text - Excel wrapped the larger block in quotes for the CSV to state that it is one cell's contents.

For the smaller text though, we now see This is" is not a movie, which is incorrect. Is there a config to resolve this?

When I try escaping the first and last quote in my strings, then the problem is solved for the smaller text and I see the quotes, but then the larger block of text begins with " and ends with " in the output as well which isn't right.

コントリビューターガイド