Closed caoxing9 closed 4 months ago
I parse a csv like csv content
hello,q,q 12,2,2 21,2,
parse function
async parse(options: Papa.ParseConfig) { const fileStream = await this.getFile(); return await new Promise((resolve, reject) => { Papa.parse(fileStream, { header: false, dynamicTyping: true, complete: function (results) { resolve(results.data); }, error: (error) => { reject(error); }, ...options, }); }); }
then the result is
{ data: [ [ '·hello', 'q', 'q' ], [ 12, 2, 2 ], [ 21, 2, null ] ], errors: [], meta: { delimiter: ',', linebreak: '\r\n', aborted: false, truncated: false, cursor: 25 } }
you see the first row hello have an extal symbol, but node can't recognize it
what's more, it only apear in string type, if the first row data is number, it is normal
extra discover, the csv file from excel by saving will meet this problem, if i create csv file by vscode, it won't.
example csv file Book4.csv
I tested your sample file in the demo instance and no extra simbol is shown.
I guess the symbol is present on the source file and for this reason is shown when parsing.
Nothing to do from our side.
I parse a csv like csv content
parse function
then the result is
you see the first row hello have an extal symbol, but node can't recognize it
what's more, it only apear in string type, if the first row data is number, it is normal
extra discover, the csv file from excel by saving will meet this problem, if i create csv file by vscode, it won't.
example csv file Book4.csv