How to inspect a UTF-8 CSV for a compliance report
Inspect a UTF-8 CSV for a compliance report, check its columns, characters and record counts, and document issues before submission.
Before you use a CSV in a compliance report, check that its columns, characters and records match what you expected. A file can open without an error and still contain missing values, damaged names or the wrong reporting period.
You can inspect a UTF-8 CSV for a compliance report in your browser, then compare it with the source and reporting requirements. Keep the original unchanged so you can trace any corrections.
Inspect the CSV before using it
- Make a copy of the original file, then open the copy in the CSV Editor. The editor opens files with up to 10 million rows. The file stays on your device and is not uploaded.
- Check that the data appears in separate columns. Compare the header row with the expected field list, including the spelling and order of column names. If a whole record appears in one column, the file may use a different separator.
- Look at characters you know should be present, such as accented names, currency symbols and text in other languages. A replacement character such as
�or a name likeJoséis a sign that the text may have been decoded incorrectly. - Inspect records from the beginning, middle and end of the file. Compare a sample with the source system or an approved export, checking identifiers, dates and values. Include records with commas, quotation marks or line breaks in text fields if the data contains them.
- Use the editor's search and sorting features to investigate required fields, unusual values and possible duplicate identifiers. Record what you find before changing anything, and check the reporting rules before removing a row.
- Compare the number of records with the source export or its accompanying report. Check important totals separately, such as the sum of amounts for the reporting period. Investigate differences rather than adjusting figures to make them match.
- Document the file name, source, export date, reporting period, checks performed and any unresolved issues. If you make an approved correction, save a separate copy and record what changed and why.
For a large file, a sample helps you spot problems but does not prove every row is correct. Ask for source totals or a repeatable validation process when the report requires a complete check.
Check that the text is valid UTF-8
Readable text is a useful sign, but it does not prove that every byte in the file is valid UTF-8. If you need a stricter check and have Python installed, you can read the file with Python's UTF-8 decoder. It stops if it encounters an invalid byte sequence.
On Windows, open PowerShell and replace the example path with the path to your file:
py -c "import sys, collections; f = open(sys.argv[1], encoding='utf-8-sig'); collections.deque(f, maxlen=0); print('Valid UTF-8')" "C:\path\report.csv"
On a Mac, open Terminal and use:
python3 -c "import sys, collections; f = open(sys.argv[1], encoding='utf-8-sig'); collections.deque(f, maxlen=0); print('Valid UTF-8')" "/path/report.csv"
The commands accept a UTF-8 file with or without a byte order mark, a short marker sometimes found at the start of a text file. If the command reports a decoding error, ask for a fresh UTF-8 export. A file not found or permission error instead means the command could not read the file. Neither command changes it.
A successful check confirms valid UTF-8, not correct content. Text that was damaged before export can still be valid UTF-8, so compare suspicious characters with the source.
Decide whether the records are usable
Required values are empty
Check the reporting instructions before treating every blank as an error. A field may be optional, not applicable or missing because of a source problem. For required values, record the affected identifiers and ask the data owner whether they can supply the missing information.
Do not fill a blank with zero unless zero is the correct value. The guide to finding empty CSV values covers how to investigate missing fields.
Dates or identifiers look different
Check the expected date format and time zone. A date such as 03/04/2025 can mean March 4 or April 3, depending on the source. If the meaning is unclear, confirm it before changing the format.
Identifiers are labels, not necessarily numbers. A leading zero in 001245 may be significant. Compare a few identifiers with the source, especially if the file has passed through a spreadsheet.
Records appear more than once
Repeated values do not always mean repeated records. One person or account may legitimately have several transactions. Compare the fields that identify a record, such as an event ID and date, and follow the report's rules before removing anything.
Fix common file problems
Columns do not line up
A CSV normally uses commas to separate fields, but some exports use semicolons or tabs. Confirm the separator with the file's creator or export settings. A comma inside a field should be enclosed in quotation marks, and a quotation mark inside a quoted field is normally written twice.
Line breaks can also occur inside quoted fields. Counting physical lines in a text editor is therefore not always the same as counting records. If rows still appear shifted after you confirm the separator, request a corrected export rather than moving values by hand.
Characters are garbled
If the source displays the names correctly, request a new export explicitly saved as UTF-8. Changing the file extension or opening and saving damaged text again does not necessarily restore the original characters. Compare the replacement file with the source before using it.
The record count does not match
First check whether both counts cover the same date range, filters and status values. Also check whether one count includes the header, blank records or records excluded from the report. Keep a note of the explanation and the source of the expected count.
Store the original, working copy and check notes according to your organization's retention and access rules. Avoid putting sensitive values in issue notes when a record identifier is enough.
