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

UTF-8 CSV files with BOM aren't parsed correctly if the first header field contains quotes #37

Open
datatraveller1 opened this issue Sep 15, 2023 · 1 comment

Comments

@datatraveller1
Copy link

datatraveller1 commented Sep 15, 2023

I have a CSV file encoded with UTF8-BOM:

"first_column","second_column"
"Hello","how are you"

This is a correct CSV file but there is the result:

Record #0 has error: bare " in non-quoted-field

The issue happens with an UTF-8 with BOM encoded file if the first header field is surrounded by quotes.

Suggestion: This could be solved by removing the UTF-8 BOM in the header line:
Pseudocode:
if (line_number == 1) { sub(/^\xef\xbb\xbf/, "", line) }

@datatraveller1
Copy link
Author

datatraveller1 commented Sep 15, 2023

I have just noticed someone else posted nearly the same issue (#21) but this simple fix (removing the UTF-8 BOM in your csvlint code) would help to succeed the csvlint check.

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

No branches or pull requests

1 participant