A six-line text file can contain only four data records. Our generated CSV has a header, four records and one newline embedded inside a quoted note. Counting visible lines would overstate the record count. Splitting each line at every comma makes a different mistake: one ordinary three-field record appears to have five fields.

We wrote a small UTF-8 sample, read it back with Python's csv module and compared every one of its twelve data fields with the original strings. All matched. These are generated labels and notes; no personal export, spreadsheet account or cloud file was read. We did not open the file in Excel or Google Sheets.

What we deliberately put in four records

CodeLabelNote and its special condition
0012A, Btwo labels, one cell — also contains a comma
0013Box "Blue"plain note
0014U+AC00 U+B098 U+B2E4 (Korean code points)first line, then a real newline, then second line
0015empty noteempty string

The Korean label is shown as code points in this English table; the downloadable CSV contains the actual characters. The file uses a comma delimiter, double-quote quoting and CRLF record terminators. The note in record 0014 contains an LF within the field. Download the actual CSV bytes to inspect the distinction: the table above describes that cell rather than inserting the embedded newline into this page's table.

A comma belongs to the data when it is inside a quoted field. A quotation mark inside a quoted value is escaped by doubling it in this writer's format. The parser returns the label Box "Blue", not a label containing the extra escape quotes. Those extra characters serve the file format rather than changing the intended cell value.

Compare physical lines with parsed records

MethodObserved resultWhat it answers
Text split into lines6 physical linesHow many line segments the text has
CSV reader5 rows including the headerHow many CSV records were parsed
Header removed4 data recordsHow many data rows this sample contains
CSV field widths3, 3, 3, 3, 3Whether header and records have three fields
Naive comma-split widths3, 5, 3, 3, 1, 3A broken interpretation of this sample

The quoted newline causes the line counter's extra segment. The unquoted meaning of commas is lost by a plain split, so a field containing a comma creates extra fragments. Fixing just the line count would not fix the comma problem. Let a CSV parser identify record boundaries and field boundaries together.

Parsing is not the same as validating your table

Our check then requires the header code,label,note and exactly three fields per data record. It deliberately rejects a missing field, an extra field and a changed header. A separate strict-parser check rejects an unclosed quoted field. These four rejections are successful checks of the stated conditions, not four damaged personal files we discovered.

A syntactically readable CSV can still use the wrong columns for a task. Conversely, a valid quoted multiline cell should not be rejected merely because a line-by-line script sees an unexpected short line. Keep syntax errors separate from schema errors so the repair matches the problem.

The normal reader used here returns strings, so code 0012 and the empty final note survive this round trip. That does not prove another importing application will choose the same types. An empty string also does not tell us whether a person meant “unknown,” “not applicable” or “intentionally blank.” Preserve an explicit status column when those meanings matter instead of guessing from the empty cell.

Reproduce this small check before adapting it

Download the Python source and run it in an empty scratch directory with Python 3.9 or later. We executed it with Python 3.9.6. It writes three explicitly named sample files in the working directory; it reads no personal folders and makes no network requests. The recorded result JSON includes the returned strings, field counts and rejection names.

For a real export, first confirm its encoding, delimiter, quote rules and whether it has a header. Set the intended schema before counting records. Do not assume a semicolon-separated export uses this sample's comma format, or that successful parsing establishes the accuracy of its contents. This check proves a finite round trip and four specified failure conditions, not universal CSV compatibility.