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

CSV Parser is parsing single quote incorrectly. #504

Open
chintan2201 opened this issue May 3, 2022 · 0 comments
Open

CSV Parser is parsing single quote incorrectly. #504

chintan2201 opened this issue May 3, 2022 · 0 comments

Comments

@chintan2201
Copy link

Hi Univocity Team,

I am facing an issue while parsing a data with multiple records with single quote. Below is the example. All other scenarios are working fine. This scenario is working fine in all third party tools such as excel, sheet etc

Example:
Input CSV:
Id,LastName,FirstName,Number,Date,Text
100, 'test, bob john, 10000, 2006-5-25, Dr Smith's Shop

Actual Output:
100,"'test,bob john,10000,2006-5-25,Dr Smith's Shop",,,,

Expected Output:
100, "'test", "bob john", 10000, 2006-5-25, "Dr Smith's Shop"

Parser setting:

CsvParserSettings settings = new CsvParserSettings();
settings.detectFormatAutomatically();
settings.setHeaderExtractionEnabled(true);
settings.setIgnoreLeadingWhitespaces(true);
settings.setIgnoreTrailingWhitespaces(true);
settings.setSkipEmptyLines(true);

// quotes inside quoted values are escaped as \"
settings.getFormat().setQuoteEscape('\\');

// but if two backslashes are found before a quote symbol they represent a single slash.
settings.getFormat().setCharToEscapeQuoteEscaping('\\');

// Max number of characters that we can read from a column
settings.setMaxCharsPerColumn(CommonUtils.MAX_CHARS_PER_COLUMN);

Note: Already tried 2.7.3 and 2.9.1(latest version)

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