Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain clearly that INVALID_OPENING_QUOTE error can be caused due to BOM character #120

Closed
alexander-kazakov opened this issue Nov 27, 2022 · 2 comments · May be fixed by Haidy777/crypto-com-app-to-blockpit#71 or priceaj/vscode-ibmi#2

Comments

@alexander-kazakov
Copy link

alexander-kazakov commented Nov 27, 2022

We've been stuck with the INVALID_OPENING_QUOTE error for days due to first row of CSV file starting with a quote:
"1800","2000 5","2000","2000 6","2000 4","2000 2","2000 3","2000 1","2500"

Apparently this was because of the BOM character and setting bom:true fixed the issue:
https://csv.js.org/parse/options/bom/

I highly recommend to add a clear explanation in the docs that INVALID_OPENING_QUOTE might be caused by not applying bom:true when files are UTF.

Ideally the library should recognise encoding / BOM character automatically by default (if possible) and enable the bom:true parameter should be handled automatically.

Otherwise this causes unexpected behavior in production when someone gives a file which starts with a quote in the first value.

@wdavidw
Copy link
Member

wdavidw commented Nov 28, 2022

I am not in favor of having any option activated by default but the error could provide an hint. However, it seems like this is not directly related with invalid opening quote. If there's no quote, maybe no error is thrown but the first field would instead contains the BOM character which isn't better.

@wdavidw
Copy link
Member

wdavidw commented Nov 28, 2022

Version 5.3.3 of csv-parse now prints an error like "Invalid Opening Quote: a quote is found on field 0 at line 1, value is "\ufeff" (utf8 bom)" See test option.bom.coffee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants