You paste a paragraph from an AI chat into a job application, a documentation file, or your codebase. It looks clean on screen. What you cannot see is that a handful of Unicode characters came along for the ride: a zero-width space wedged between two words, a non-breaking space where a normal space should be, curly quotes instead of straight ones. These invisible hitchhikers are more common than you'd think, and they can cause real problems in production.

The Unicode Zoo Hiding in Plain Sight

Zero-width spaces (U+200B) are exactly what they sound like—invisible characters that take up no visual space but still exist as distinct code points. Non-breaking spaces (U+00A0) look identical to regular spaces in most editors but behave differently, especially in programming contexts where string comparisons and parsing can fail silently. Then there are the curly quotes—left double quotation mark (U+201C), right double quotation mark (U+201D)—which differ from their ASCII counterparts and can break JSON validation, SQL queries, and regex patterns that expect straight quotes.

Why AI Models Generate These Characters

Large language models don't think in characters—they think in tokens. When an LLM generates text, it's predicting token sequences based on training data that includes published writing full of typographic conventions. Curly quotes are statistically normal in human-written prose, so LLMs naturally reproduce them. Zero-width spaces can appear when the model processes certain boundary conditions or when copying passages from its internal representations. The result is output that looks perfect to humans but contains subtle Unicode artifacts invisible to casual inspection.

How to Catch These Sneaky Characters

Detecting these characters requires looking beyond what your eyes see. Most code editors have a "show whitespace" option, though zero-width spaces typically don't show up even there. For robust detection, consider using a linter with Unicode-aware rules, or write a quick script that scans strings for known problematic code points. JavaScript's String.prototype.normalize() method can convert curly quotes to straight equivalents, and most programming languages have equivalent normalization libraries. For documentation and prose, tools like detex or custom regex patterns targeting U+200B, U+00A0, U+201C-U+201F, and similar ranges will catch the culprits.

Practical Defenses for Your Pipelines

The most effective defense is sanitization at input boundaries. If you're building systems that accept AI-generated content—whether from internal tools or user-provided text copied from chatbots—normalize Unicode before processing. Configure your linters to flag non-standard whitespace characters in codebases where string literals come from external sources. For documentation workflows, consider adding a pre-commit hook that strips invisible characters from staged files. The key is treating AI output like untrusted input: validate and sanitize before it touches your systems.

Key Takeaways

  • Copy-paste operations from AI chats routinely introduce zero-width spaces, non-breaking spaces, and curly quotes
  • These characters pass visual inspection but can break string comparisons, JSON parsing, regex matching, and code compilation
  • Unicode normalization libraries exist in every major language—use them at input boundaries
  • Add linter rules or pre-commit hooks to catch invisible character contamination in your repositories

The Bottom Line

This isn't theoretical—I've seen builds break because a developer copied an error message from ChatGPT and the curly quotes inside it failed JSON validation. Treat AI output as untrusted input, normalize early, and add detection tooling to your pipelines before these ghost characters bite you in production.