Regular expressions and text guides

Text Diff: invisible line endings and Unicode differences

Diagnose CRLF, LF and normalization differences before removing whitespace or rewriting data.

Nav Tools ·

Inspect invisible bytes

Two visually identical files can differ in CRLF versus LF line endings or in a final newline. A text diff may report many changed lines.

Compare a small affected region in a byte or escape view. Find the representation difference before changing the entire file.

LF:   0a
CRLF: 0d 0a

Normalization changes representation

An accented character can be precomposed or represented by a base letter and combining mark. JavaScript equality compares the underlying sequence.

NFC normalization can align canonically equivalent strings for an agreed comparison. It is a deliberate transformation, not an automatic reason to overwrite stored source.

"\u00e9" === "e\u0301" → false
"\u00e9".normalize("NFC") === "e\u0301".normalize("NFC") → true

Whitespace can be significant

Trimming trailing spaces may be appropriate for prose but can change fixtures, Markdown line breaks or signed message bytes.

Decide whether you want exact comparison or a normalized review. Keep the raw data when hashes, signatures or source-preserving edits depend on it.

Verify the intended change

After an intentional normalization, compare again and inspect one actual content change. This confirms that a representation cleanup did not hide a real edit.

For JSON values use JSON Diff as well. Text equality and structural equality answer different questions and should be chosen according to the task.

References

← Regular expressions and text guides