Why can cleaned pasted text still contain invisible characters?

Text cleanup changes specific kinds of spacing, so hidden characters can remain. Here's what Trim and Collapse actually change, and how you can see what's left.

Why does trimming leave hidden characters in pasted text?

Trim works like snipping the blank ends off a ribbon: it doesn't reach into the middle. It removes JavaScript-recognized whitespace at the beginning and end, including ordinary spaces, tabs and nonbreaking spaces. Both position and character type matter: a zero-width space isn't recognized as whitespace by Trim, so it can remain even at an end. Repeating Trim won't change that result.

Here, trimming removes the outer spaces while leaving the space between A and B.

Input: a nonbreaking space, A, a punctuation space, B, a nonbreaking space. After Trim: A, the punctuation space, B.
Illustration: the outer markers stand for nonbreaking spaces; the middle marker is a punctuation space (U+2008). How we reviewed pasted-text cleanup

Why does collapsing spaces leave some gaps unchanged?

Collapse tackles repeated keyboard spacing inside a line. Think of a sorter that recognizes ordinary spaces and tabs: each run becomes one ordinary space. Other blank-looking characters pass through unchanged. Line breaks stay, and a run at the start or end becomes one space instead of disappearing.

In this recorded paste, Collapse shortens the runs of spaces and tabs; the nonbreaking space and zero-width space remain.

Input and Collapse output on matching lines, with visible markers for ordinary spaces, tabs, line breaks, a nonbreaking space and a zero-width space.
The green marker labels identify the characters Collapse leaves alone; every line-break marker also stays.

Doing it in FluffyBench: choose a cleanup and check your text

FluffyBench's Text cleaner keeps your paste and result in separate editors. Choose the spacing change you need from To; the screenshots follow Collapsed spaces using the same paste as the comparison above. The selector's other outputs do different jobs, so don't choose a label-making option to fix a gap in a sentence.

Here's the cleanup from choosing an output to copying it. The screenshots show the phone tabs; on a wider screen, Input and the result sit side by side.

  1. FluffyBench Text cleaner: From Text, To Collapsed spaces.
    FluffyBench Text cleaner: From Text, To Collapsed spaces.
    Step 1. Choose the spacing change: Trimmed text for the ends, or Collapsed spaces for repeated keyboard spacing.
    1. Leave From on Text.
    2. Choose Collapsed spaces under To.
  2. Input holds the recorded mixed-spacing sample; Input and Result tabs appear above it.
    Input holds the recorded mixed-spacing sample; Input and Result tabs appear above it.
    Step 2. Paste into Input. Short text updates live; on a phone, tap Result to see the output.
    1. Paste the text you want to clean.
    2. Tap Result to view the cleaned text.
  3. Collapsed spaces result with Input and Result tabs and the Copy button.
    Collapsed spaces result with Input and Result tabs and the Copy button.
    Step 3. Keep your original in Input for comparison. Check the result, then Copy the cleaned text.
    1. Return to Input to compare your original.
    2. Check the spacing and line breaks.
    3. Copy puts the result on your clipboard.

Need to clean the spaces in pasted text?

Still seeing a mystery gap? Inspect the characters

A gap's appearance doesn't tell you what made it. FluffyBench's Unicode inspector gives each stored character a row and a code point: an ID such as U+00A0. That lets you tell a nonbreaking space from a keyboard space without guessing from the width of the gap. The UTF-16 offset column locates it in the stored text, counting from zero.

Here's the Collapse result in FluffyBench's Unicode inspector, with the surviving characters listed by ID and position.

  1. FluffyBench Unicode inspector: From Text, To Code points.
    FluffyBench Unicode inspector: From Text, To Code points.
    Step 1. In FluffyBench’s Unicode inspector, choose Text → Code points to identify what survived cleanup.
    1. Choose Text as your input type.
    2. Choose Code points to list stored values.
  2. The Collapse output pasted into the Unicode inspector Input.
    The Collapse output pasted into the Unicode inspector Input.
    Step 2. Paste the cleaner’s result into Input; the code-point report appears alongside it.
    1. Paste the cleaned text here.

The Code point column identifies the surviving nonbreaking space (U+00A0) and zero-width space (U+200B); UTF-16 offset locates them.

Actual Unicode inspector result with U+00A0 at offset 4 and U+200B at offset 7 outlined and named.
Detail from the actual report, annotated to name the two surviving characters.

Finding a character gives you a decision to make, not an automatic deletion rule. A nonbreaking space may be keeping a name together; a zero-width character may be part of text you need to preserve. Change the character once you know what it's doing in the destination where you'll use the text.

Making a web address label? Expect characters to change

The label options make a name tag from a phrase. They're useful when you want a short web address label or an identifier for code; they're a different job from spacing cleanup. A Unicode slug can keep letters from other writing systems. An ASCII identifier uses basic Latin letters, digits and underscores, removing accents and leaving out Japanese text.

This recorded phrase keeps its Japanese text in the Unicode slug and loses it in the ASCII identifier; the emoji is absent from both.

Input: Café Café 東京 👩‍💻. Unicode slug: café-café-東京. ASCII identifier: cafe_cafe.
Both returned labels come from the same phrase; neither is a copy of the original sentence.

How we reviewed pasted-text cleanup

We used generated examples for edge whitespace, mixed spacing and Unicode text. The edge sample includes invisible characters between letters as well as whitespace at its ends. The mixed sample supplies the Collapse comparison and walkthroughs. The Unicode phrase contains two stored spellings of Café, Japanese letters and a joined emoji.

These are the recorded UTF-8 byte lengths for the input and each returned string.

Returned stringEdge sampleMixed sampleUnicode sampleWhat the row means
Input bytes54 B54 bytes21 B21 bytes31 B31 bytesStarting string length.
Trim result45 B45 bytes16 B16 bytes31 B31 bytesRecognized whitespace removed from the two ends.
Collapse result52 B52 bytes16 B16 bytes31 B31 bytesRuns of ordinary spaces and tabs become one space.
Unicode slug24 B24 bytes7 B7 bytes18 B18 bytesReturned Unicode label length.
ASCII identifier24 B24 bytes7 B7 bytes9 B9 bytesReturned ASCII label length.
Trim and Collapse leave the Unicode phrase unchanged.
Search FluffyBench