CRLF Inside Quotes Preserver

Normalize only CSV record endings to LF or CRLF while preserving quoted cell bytes and whether the document had a terminal record ending.

Description

CSV record endings and quoted cell line endings have separate meanings.

CSV record endings and quoted cell line endings have separate meanings. Normalizing only record endings preserves multiline cell spelling.1

Normalize only CSV record endings to LF or CRLF while preserving quoted cell bytes and whether the document had a terminal record ending.

When to use CRLF Inside Quotes Preserver

Use this for the following task: Normalize only CSV record endings to LF or CRLF while preserving quoted cell bytes and whether the document had a terminal record ending.

Prepare the CSV text, decoded cells or byte values requested below. Choose delimiter and header flags explicitly when those fields are present.

How to use CRLF Inside Quotes Preserver and understand its results

  1. Prepare the CSV text, decoded cells or byte values requested below. Choose delimiter and header flags explicitly when those fields are present.
  2. Enter csv, delimiter, recordEnding using the field table, then run the tool.
  3. Read csv. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
csvCSV textstring; maximum text length 100000Required
delimiterDelimiterstring; choose ",", ";", "\t"Required
recordEndingRecord endingstring; choose "LF", "CRLF"Required

Parse valid raw record fragments, join them with the selected ending and retain whether an outer terminal ending existed.2

Parse delimiters only outside quoted fields and decode doubled quotes. A quoted line break stays inside its cell; malformed quoting is returned as an input error.

output = rawRecords joined with requested LF/CRLF plus original terminal-ending presence

This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.

Output fieldMeaningValue type
csvCSV textstring
json
{
  "input": {
    "csv": "a,b\r\n\"x\r\ny\",z\r\n",
    "delimiter": ",",
    "recordEnding": "LF"
  },
  "output": {
    "csv": "a,b\n\"x\r\ny\",z\n"
  }
}

Limitations and assumptions

Quoted embedded endings and quote spelling are preserved. This is text processing, not encoding conversion.

Where CSV is parsed, the shared parser accepts comma, semicolon or tab separators, doubled quotes and quoted line breaks, with CR/LF/CRLF record endings. Blank records remain records. CSV inputs are bounded to 100000 UTF-16 units and 10000 fields. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.

Alternative or Complementary methods

Choose Minimal Quoting Only-When-Needed Style for this operation: Rewrite CSV using quotes only for a delimiter, double quote, or line break, additionally quoting a one-cell empty record to preserve it; use LF without a terminal newline. For a complementary task, use Multiline Quoted Cell Line Counter for this operation: Find decoded CSV cells containing CR or LF and report their one-based line counts, counting CRLF as one break; positions are zero-based record and column indices.

Further background: Format and language reference: CRLF Inside Quotes Preserver.

References

  1. Format and language reference: CRLF Inside Quotes Preserver — RFC Editor

  2. CRLF Inside Quotes Preserver — tool.io

Similar or alternative tools

  • Minimal Quoting Only-When-Needed Style

    Rewrite CSV using quotes only for a delimiter, double quote, or line break, additionally quoting a one-cell empty record to preserve it; use LF without a terminal newline.

  • Multiline Quoted Cell Line Counter

    Find decoded CSV cells containing CR or LF and report their one-based line counts, counting CRLF as one break; positions are zero-based record and column indices.

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