What Is Pasted Text Damage and Why Does It Happen?
Pasted text damage consists of hidden Unicode control characters, non-breaking spaces, curly quotes, and em dashes injected by Word, PDFs, web pages, and AI chatbots that break code parsers and layout engines.
When you copy text from modern word processors (like Microsoft Word or Google Docs), PDFs, chat tools, or generative AI assistants, the text arrives with invisible formatting artifacts:
- Invisible Zero-Width Characters: Zero-width spaces (
\u200B), byte-order marks (\uFEFF), and soft hyphens (\u00AD) that silently break string equality, code compilation, database searches, and git diffs. - Typographic Smart Quotes: Curly quotes (
“ ” ‘ ’ „ ‚) that cause syntax errors in terminal scripts, JSON files, SQL queries, and configuration files. - Em and En Dashes: Punctuation marks (
— – ‒ ―) that interfere with command-line flags and hyphenated identifiers. - Trailing Whitespace & Strange Line Breaks: Ghost spaces and tabs at the ends of lines, plus runs of excessive blank lines.
How Does the 1-Tap Paste Repair Algorithm Work?
The engine runs five sequential regex and Unicode passes while respecting regional typography conventions (such as German low quotes U+201E and French guillemet spacing U+00AB U+00A0).
Text Cleaner's Clean pasted text engine executes a safe, deterministic 5-step normalization sequence:
- Strips zero-width characters outright while normalizing exotic Unicode spaces (such as non-breaking
\u00A0or thin spaces) to standard ASCII spaces. - Converts smart quotes to standard straight double (
") and single (') quotes. - Converts em and en dashes into standard hyphens (
-). - Trims trailing whitespace from every line without touching intentional line starts.
- Collapses runs of 3 or more blank lines down to clean double newlines (paragraphs).
What Regex & Unicode Rules Are Applied in Clean Pasted Text?
Below is the exact transformation table with Unicode code points and a worked before/after audit showing character and line count changes:
Worked Before / After Example: Input The quick brown fox—as they say—jumps over the “lazy” dog.\u200B \n\n\nVisit acme.com or pay $9.99 for version 1.5... Right? U.S.A. today. (135 characters, 23 words, 4 lines) → Output The quick brown fox-as they say-jumps over the "lazy" dog.\n\nVisit acme.com or pay $9.99 for version 1.5... Right? U.S.A. today. (127 characters, 23 words, 3 lines; 2 em dashes, 2 curly quotes, 1 zero-width space, 6 trailing spaces, and 1 extra blank line repaired).
| Pipeline Step & Unicode / Regex Rule | Input Example (Before) | Output Result (After) | Characters / Lines Changed (count) |
|---|---|---|---|
1. Zero-Width Strip ([\u200B-\u200D\u2060\uFEFF\u00AD]) |
dog.\u200B (5 chars) |
dog. (4 chars) |
-1 hidden char removed |
2. Exotic Space Normalize ([\u00A0\u2002-\u2009\u202F\u3000] → U+0020) |
hello\u00A0world (11 chars) |
hello world (11 chars) |
1 NBSP normalized to ASCII space |
3. Straighten Quotes ([\u201C\u201D] → ", [\u2018\u2019] → ') |
“lazy” ‘dog’ (12 chars) |
"lazy" 'dog' (12 chars) |
4 curly quotes straightened |
4. Normalize Dashes ([\u2012-\u2015] → U+002D) |
fox—as–said (11 chars) |
fox-as-said (11 chars) |
2 typographic dashes → hyphens |
5. Trim Trailing & Collapse Newlines (s/[ \t]+$//gm, s/\n{3,}/\n\n/g) |
Line 1 \n\n\nLine 2 (21 chars, 4 lines) |
Line 1\n\nLine 2 (14 chars, 3 lines) |
-7 chars (-6 spaces, -1 newline) |
Is Clean Pasted Text 100% Client-Side & Private?
Yes—100% of text cleaning executes locally inside your browser's JavaScript engine with zero network requests or server logging.
Unlike other web utilities that upload your clipboard content to remote servers, Text Cleaner processes everything directly on your device using client-side JavaScript. Nothing leaves your browser.