Bug 306791 - CSV import new line within cells
Summary: CSV import new line within cells
Status: REPORTED
Alias: None
Product: calligrasheets
Classification: Applications
Component: filters (show other bugs)
Version: 3.1.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Calligra Sheets (KSpread) Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-14 13:50 UTC by vasthusya
Modified: 2020-11-07 11:48 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Contains Qt project with extracted code and python script for comparison (3.32 KB, application/x-bzip)
2012-09-14 13:55 UTC, vasthusya
Details
Rewrite parser loop to handle multiline (10.14 KB, patch)
2012-09-15 11:09 UTC, vasthusya
Details
Handles content between quote escapes by inclusion (11.52 KB, patch)
2012-09-16 03:34 UTC, vasthusya
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vasthusya 2012-09-14 13:50:21 UTC
The CSV parser assumes the end of row for each new line, even when the cell is wrapped with double quotes.

Reproducible: Always

Steps to Reproduce:
1. From Calligra sheets
2. Open a CSV file with new lines in cells
Actual Results:  
Each new line within cell content creates a new row, causing blank columns and other problems.

Expected Results:  
The new lines should be treated as contents for the table cell.

In libs/widgets/KoCsvImportDialog.cpp
Comment 1 vasthusya 2012-09-14 13:55:48 UTC
Created attachment 73911 [details]
Contains Qt project with extracted code and python script for comparison

The Qt-based test files aren't using QTableWidget as in the actual file, instead it's using QStandardItemModel for less bloaty testing.
Comment 2 vasthusya 2012-09-15 11:09:28 UTC
Created attachment 73930 [details]
Rewrite parser loop to handle multiline

Difficult to understand the per-character state machine loop. My patch works for quote-escapes, empty cells and multi-line as long as quotes are adjacent to delimiters.
Comment 3 vasthusya 2012-09-16 03:34:20 UTC
Created attachment 73954 [details]
Handles content between quote escapes by inclusion

Combine escaped content with last cell or take the next cell if the delimiter is not adjacent to the quotes.
Comment 4 Andrew Crouthamel 2018-11-09 01:06:19 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Andrew Crouthamel 2018-11-20 04:01:07 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 6 b2.temp 2020-11-07 11:46:17 UTC
Still a problem using version 3.1.0 (Fedora packages)