CSV Text Cleaner

Remove a UTF-8 BOM, normalize line endings, and clean a CSV header.

Description

CSV text preparation can remove a leading byte-order mark, normalize line endings and trim simple header cells.

CSV text preparation can remove a leading byte-order mark, normalize line endings and trim simple header cells. These are text operations before a separate CSV parser.1

Remove a UTF-8 BOM, normalize line endings, and clean a CSV header.

When to use CSV Text Cleaner

Use this tool to remove a UTF-8 BOM, normalize line endings, and clean a CSV header.

Prepare the text, recorded observations, aligned figures or editorial criteria requested. Confirm what each label, count, timestamp or supplied flag represents before interpreting the result.

How to use CSV Text Cleaner and understand its results

  1. Prepare the text, recorded observations, aligned figures or editorial criteria requested. Confirm what each label, count, timestamp or supplied flag represents before interpreting the result.
  2. Enter csvText, normalizeLineEndings, trimHeaderCells using the field table and calculation rules, then run the tool.
  3. Read cleanedCsvText, bomRemoved, headerCellCount, replacementCharacterCount. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
csvTextCSV textstringRequired
normalizeLineEndingsNormalize line endingsbooleanRequired
trimHeaderCellsTrim header cellsbooleanRequired

Enter text and both flags. Remove one leading BOM, split on LF, optionally trim first-line comma-separated cells and rejoin with LF. Return cleaned text, header-cell count and U+FFFD replacement-character count; empty text has zero header cells.

remove leading U+FEFF; optionally CRLF/CR→LF; optionally trim comma-split header cells

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
cleanedCsvTextCleaned CSV textstring
bomRemovedUTF-8 BOM removedboolean
headerCellCountHeader cell countinteger; minimum: 0
replacementCharacterCountUnicode replacement charactersinteger; minimum: 0
json
{
  "input": {
    "csvText": " name , age\r\nAda,36",
    "normalizeLineEndings": true,
    "trimHeaderCells": true
  },
  "output": {
    "cleanedCsvText": "name,age\nAda,36",
    "bomRemoved": true,
    "headerCellCount": 2,
    "replacementCharacterCount": 0
  }
}

Limitations and assumptions

Header splitting does not honor quoted CSV commas. Replacement characters are counted, not repaired; CR-only input is not split into lines when normalization is disabled.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors. A successfully returned false flag is an evaluated outcome; its meaning is explained above.

Alternative or Complementary methods

Use Document Entity Date Sorter: Parse compact document records, sort them by dateline, and collect unique named entities. For a complementary task, use Table Total Check: Sum supplied table rows and compare the result with a published total.

References

  1. CSV Text Cleaner — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies