Documents & OCRPractical guides

Garbled CSV text? Reopen the UTF-8 original before saving another copy

When a CSV shows garbled text, close the incorrect preview and preserve the original before choosing its actual encoding. Saving the garbled display as UTF-8 can simply preserve the wrong characters. Two original teaching files, differing only by a BOM, show when to reimport and when an earlier source is needed.

Handwritten Chinese characters arranged on grid paper, illustrating character checking
Illustrative photo: jason hu · Unsplash LicenseIllustrative lettering photograph; the CSV names and amounts are original teaching material.

The practical answer

Both valid UTF-8 originals should preserve all three source names, IDs 0007/0008/0009 and amounts 12.50, 0.00 and 7.50, totaling 20.00. The optional leading EF BB BF helps some receivers recognize the encoding. It does not choose delimiters, preserve identifier types or reconstruct text already replaced by question marks or replacement characters.

Choose a repair from the symptom

Garbled names, an entire line in one cell and missing leading zeros point to character decoding, field boundaries and column types respectively. One bad-looking preview is not a single diagnosis. Identify the affected layer on a copy instead of deleting unusual characters or turning the entire table into numbers.

Microsoft’s text and CSV import documentation distinguishes direct opening from a controlled import. This workflow leaves system-wide regional settings unchanged and chooses encoding and separation for this particular file.

Separate three visible failures
SymptomFirst checkCorrect state in this case
The first source name becomes meaningless charactersOriginal bytes and chosen encodingAll three source names match character for character
A whole line occupies one cellComma separationThree columns and four rows including the header
0007 becomes 7Identifier converted to a numberAll three IDs remain text

Two originals with exactly the same text

The pack’s source-utf8.csv and source-utf8-bom.csv both use UTF-8, commas and LF newlines. The second adds only the three leading bytes EF BB BF. These are fictional teaching records; both language versions retain the same names for direct comparison.

A damaged-replacement.csv control deliberately replaces one name with U+FFFD. It is not the valid source to recover from. It demonstrates that opening a file successfully as UTF-8 does not establish that its content survived.

Complete text of both valid CSV files

ID,Name,Amount
0007,上海,12.50
0008,Zoë,0.00
0009,東京,7.50
One header and three records. Zero is a known amount, not missing data. A final LF follows the last record.

File identity and decoded text
FileLeading bytesHeader after correct UTF-8 decoding
source-utf8.csv49 44 2CID,Name,Amount
source-utf8-bom.csvEF BB BF 49 44 2CID,Name,Amount
damaged-replacement.csvUTF-8 content deliberately includes a replacement characterA valid header cannot prove that names are intact

Reopen the source with UTF-8 selected explicitly

Microsoft’s UTF-8 CSV guidance recommends a BOM for normal opening, or using Text/CSV import through Get Data or the Text Import Wizard. Menus differ across versions and platforms. If your version lacks the named path, consult its documentation rather than treating a changed file extension as a conversion.

In Excel, preserve the source and choose Data → From Text/CSV to import it. Confirm UTF-8 as the file origin and comma as the delimiter. Use the transform step to keep ID as text and treat only Amount as numeric. Check every name and all three columns before loading a fresh workbook. This article does not claim an execution in your Excel version.

For a local browser route to XLSX, use CSV to Excel: select a valid original, UTF-8, comma separation and a header; keep ID and Name as text and select a numeric Amount. Convert and download. The tool reads the encoding you select; it cannot identify every unknown historical encoding or restore a name that has already been damaged.

  1. Preview source-utf8.csv and confirm four rows including the header, three columns and every name.
  2. Keep identifiers and names as text, changing only Amount to a numeric type.
  3. Download the XLSX, reopen the actual file from disk and compare every record with the answer below.
  4. Repeat with source-utf8-bom.csv under the same settings. Compare cell contents, not the resulting files’ hashes.

Check original text, types and totals separately

There are only three short records, so compare every character. 0007, 0008 and 0009 must each keep four digits. Zoë ends with ë rather than e. The two CJK names are distinct source strings; merely seeing readable Chinese is not sufficient. Use the literal source and reference cells below for the exact characters.

For the numeric Amount column, 12.50 + 0.00 + 7.50 = 20.00. An XLSX display format may show 12.50 as 12.5 without changing its value. Compare name characters, identifiers and numeric values separately. Passing these three records does not validate an unrelated large file.

Reference results for all three records
ID (text)Name (text)Amount (number)
0007上海12.50
0008Zoë0.00
0009東京7.50

A readable damaged file may still be unrecoverable

Failure state

A name was saved as �. Selecting UTF-8 now still opens the file without a decoding error.

Correct next step

Return to the unchanged source export or request a new export from its sender. Retain the damaged file for comparison.

An encoding instructs the reader how to interpret bytes. One replacement character does not identify the lost original name, and a BOM cannot restore those bytes.

Separate reading the same bytes from writing new bytes

If an incorrectly decoded preview has not been saved, the unchanged original can usually be reopened with the correct encoding. Once the wrong display has been re-encoded and saved, compare an earlier backup. Do not repeatedly convert it until it resembles a plausible name. For an actual GBK or UTF-16 file, confirm the source encoding; this exercise does not offer universal automatic detection.

If names are correct but columns or identifiers are still wrong, continue with the CSV field-boundary and type guide. To agree which original was received, use the file identity and SHA-256 handoff. Different hashes for BOM and non-BOM files do not by themselves mean different names or amounts.

Specify UTF-8, BOM presence, comma separation, a header and the ID text requirement. Include the three-record/20.00 sample checks. CSV does not carry Excel cell types, so a future import still needs those conditions.

Common questions

Should every CSV receive a BOM for compatibility?

No. Receivers handle it differently; some scripts treat it as part of the first column name. Check a small sample in the actual receiver and verify that ID is recognized. If it does not support a BOM, agree on UTF-8 without one and specify the encoding explicitly. Delimiters, column types and already damaged content remain separate issues.

Further reading & sources

Put the guide into practice

Open the relevant tool, preview the result and check your exported file.

Related articles