Why hidden characters in code matter
They break exact matching, and almost everything downstream depends on it. Invisible characters programming problems all share this root: an identifier that looks correct and does not resolve. Two strings that look identical stop being equal, and every comparison built on that inherits the failure.
The characters arrive through the clipboard rather than the keyboard. A PDF export substitutes U+00A0 for spaces to hold its layout. A web page carries U+200B for line-break control. Newer AI models emit U+202F in place of ordinary spaces. None is deliberate, and all of them travel with the text.
Why trimming does not fix it
Trimming removes only the characters whose Unicode propertyWhite_Space is Yes. That covers the 17 space separators and none of the zero-width characters.
Every Cf character — U+200B, U+200C, U+200D, U+2060, U+FEFF — hasWhite_Space=No, so trim(), TRIM() and the regex class\s all leave them in place. This is why the obvious fix appears to do nothing.
Match the category instead. Full property data for all 29 characters is on the Unicode invisible characters table.
Choose your tool
Each guide covers one application: how to see the characters there, how to remove them, and what they break in that context.