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

Fix bug where closing quote was not removed #468

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tec
Copy link

@tec tec commented Mar 10, 2023

I have seen many (manually edited) csv files in the wild that are formatted to visually have commas like columns. Example:

title ,description                                 ,number value,    more text,number 2
line 1,"short, precise"                            ,5           ,    sometimes,1
line 2,"a long, long description"                  ,6           ,         even,2
line 3,"an even longer description with many words",5           ,right-aligned,3
line 4,         "     and crazy stuff     "        ,5           ,      columns,3

The current implementation has some errors with those lines.

This closing quote and the whitespace is not removed (only the last space to be precise):

line 1,"short, precise"                            ,5           ,    sometimes,1
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This whitespace is not removed even if option trim is enabled (neither is the closing quote)

line 4,         "     and crazy stuff     "        ,5           ,      columns,3
                 ^^^^^               ^^^^^

The pull requests fixes those issues

from parsed cell when there are delimiters inside the quoted text and
trailing whitespace before the next cell delimiter
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

Successfully merging this pull request may close these issues.

None yet

1 participant