Illustration of document pages being combined, with a padlock and a file tab.

Why Copied Text Breaks Forms and Searches

A code copied from an email is rejected. A name copied from a spreadsheet does not match the same name typed by hand. A search for a phrase you can see on the page returns nothing. In each case the text looks correct, and in each case the characters are not what they appear to be.

The Invisible Character Cleaner shows what is actually in the string. This article explains why the mismatch happens, which is usually more useful than the fix.

Quick answer

Forms and searches compare characters, not appearance. Copied text often contains a non-breaking space where you expect a normal one, or a zero-width character where you expect none, and either makes the string different from the one the system is checking against. The comparison fails even though the two strings look identical on screen. Cleaning the text or retyping the value resolves it.

The non-breaking space problem

This is the most common cause. A non-breaking space looks exactly like a space and behaves like one in prose, but it is a different character. Text copied from a web page, a formatted document, or a spreadsheet cell often contains them.

A search for a two-word phrase will fail if the gap between the words is a non-breaking space, because the system is looking for an ordinary space. The same applies to a form that validates a value against a pattern. It is the single most common reason a copied phrase does not match.

Trailing and leading characters

Copying from a table cell frequently brings a trailing space or a trailing invisible character. On screen the value looks clean. In a database it is longer than the stored value by one character, so an equality check fails.

Password fields are the worst case, because the field hides what it received. A pasted password with a trailing space is wrong in a way you cannot see, and the error message says the password is incorrect rather than that it contains an extra character.

Line breaks and formatting

Copying from a rendered page can bring line breaks where the text merely wrapped on screen. A code or a serial number may already contain a line break in the clipboard even though it appears on one line. Pasting into a single-line field then inserts characters the field does not expect.

Rich text also carries formatting, and some fields reject the pasted content outright rather than stripping it. Pasting as plain text avoids both problems at once.

What to do about it

  • Retype short values, such as codes and passwords, rather than pasting them.
  • Paste as plain text when the destination allows it, which drops formatting and most stray characters.
  • Run a cleaner over copied text before using it for anything that must match exactly.
  • When a search fails on text you can see, suspect a space character before suspecting the search.

For the wider cleanup procedure, see How to Remove Invisible Characters from Copied Text. For what the characters themselves are, see What Zero-Width Characters Do to Your Text.

Paste the failing value into Invisible Character Cleaner to see what it actually contains, then copy the cleaned version.

Common questions

Why does a phrase I can see on the page not match in a search?

The most common cause is a non-breaking space where you expect an ordinary one. The two look identical but are different characters, and the search compares characters rather than appearance. A zero-width character in the gap causes the same failure.

Why is my pasted password rejected?

It probably carries a trailing space or invisible character. Password fields hide what they received, so the extra character is invisible and the message says the password is incorrect. Retyping it by hand resolves this reliably.

Does pasting as plain text fix this?

It removes formatting and most stray characters, which fixes the common cases. It does not remove every invisible character, because some survive a plain-text paste. For text that must match exactly, running it through a cleaner is the reliable step.