Morrow CreekData Services
← Morrow Creek Data Journal

Invisible whitespace can break a match without looking wrong

Morrow Creek Data ServicesMorrow Creek Data Journal

A procurement sheet contains Northstar Labs in one column and what appears to be Northstar Labs in another. An exact lookup returns no result.

The likely instinct is to check spelling, search for duplicates, or question the lookup. Those are reasonable checks, but there is another possibility: the values may not contain the same characters.

One value might use an ordinary space between the words. The other might contain a no-break space. On screen, they can look identical. In storage, they are different Unicode code points, so an equality-based lookup, join, filter, validation rule, or duplicate check can treat them as different values.

Visible text is not always the stored text.

The characters behind the screen

The ordinary space used in much English-language text is U+0020. Unicode also includes U+00A0 NO-BREAK SPACE, which normally has the same width but prevents a line break at that position. U+202F NARROW NO-BREAK SPACE is another distinct space character.

Then there is U+200B ZERO WIDTH SPACE. It ordinarily has no visible width at all. A value such as INV-10482[ZWSP] may look exactly like INV-10482, yet it has an additional code point. A strict comparison can therefore report that the two are unequal.

This does not mean every failed match is a whitespace issue. Punctuation, letter case, line breaks, Unicode normalization, encoding damage, data types, and genuinely different values can produce similar symptoms. The useful habit is to inspect characters before deciding that a record is duplicated, missing, or misspelled.

Treat the failure as a diagnostic problem first

When apparently identical values do not match, start with a small suspect set rather than applying a broad cleanup rule to an entire column.

First, retain the original field. A company name, address, description, or identifier may need to remain exactly as received for audit, display, or later investigation. Overwriting it makes the original discrepancy harder to explain.

Next, compare lengths. A trailing zero-width character or an unexpected leading space often appears as an extra character even when it is invisible in the worksheet or application view.

Then inspect the value in a form that reveals hidden characters. Depending on the tool, that might mean showing code points, using escaped representations, examining the first and last character, or temporarily replacing suspected characters with clearly visible labels. Marked examples avoid asking reviewers to spot differences their software may not display:

  • Northstar⍽Labs — ordinary space
  • Northstar[NBSP]Labs — no-break space
  • INV-10482[ZWSP] — zero-width space at the end

Once the character is known, decide whether it is noise for that field and purpose. That distinction matters. A comparison key for account-name matching may reasonably convert a no-break space to an ordinary space. Removing every invisible or nonbreaking character from a multilingual free-text field may change meaningful line-breaking or word-separation behavior.

Normalize a key, not the evidence

A safer pattern is to maintain separate fields:

  • company_name_raw for the source value
  • company_name_match_key for the documented comparison value
  • normalization_applied for a record of what changed

The match key can use narrowly defined rules: perhaps replace U+00A0 with U+0020, trim permitted outer whitespace, and preserve internal spaces. The right rule depends on the field specification and the decision the match supports. An internal space in an identifier can be part of the identifier, not cleanup noise.

After normalization, measure two outcomes. Count records that were previously unmatched and now match. Then count distinct source values that collapse to the same comparison key. The first number reveals recovered matches. The second reveals possible false matches.

That collision review is essential. If A B, A[NBSP]B, and AB all become one key after an aggressive rule, the process may have created more confidence than the underlying data deserves.

Spreadsheet cleanup has limits

A familiar spreadsheet cleanup command can help, but its name does not guarantee that it handles every kind of whitespace. Microsoft documents Excel's TRIM function as removing ASCII space character 32. Imported text may instead contain character 160, the no-break space, which can require a targeted substitution before further cleanup. Microsoft also notes limits to CLEAN for certain Unicode-era characters.

That is a broader lesson, not just an Excel quirk: whitespace definitions differ across tools and runtimes. Test the actual system that performs the match. A transformation that looks successful in a preparation step may behave differently in a database, reporting tool, spreadsheet, or downstream application.

For imports and shared datasets, establish a short control: preserve source text, define allowed normalization by field, flag unexpected characters, and review new key collisions. When two values look the same but fail to match, the screen is only the beginning of the investigation.

Have a dataset that needs to become usable?

Morrow Creek Data Services handles paid research, cleanup, verification, and structured delivery projects.

Start a data project