Copied text can contain non-breaking spaces, zero-width characters, soft hyphens, curly quotes, line breaks at visual column boundaries, and fragments of page navigation. Cleanup should be staged so meaningful paragraphs, lists, and code survive.
Identify before replacing
Turn on invisible-character display when available. Distinguish paragraph breaks from line wraps, tabs from alignment spaces, and intentional Unicode from corruption. Normalize line endings first, then handle repeated whitespace and punctuation with explicit rules.
Use conservative transformations
Join lines only when the prior line appears to continue a sentence. Preserve blank lines between paragraphs. Replace non-breaking spaces with ordinary spaces where layout is no longer needed. Unicode normalization can combine equivalent character sequences, but transliteration to ASCII may lose names, symbols, and non-English text.
Validate structured material
Tables copied from PDFs may need CSV reconstruction. Code and command examples should not pass through prose cleanup rules. Compare word count and sample passages before and after, and keep the original until the cleaned result is accepted.
Worked example
A PDF paragraph arrives with a newline after every 70 characters and a hyphen in “docu-\nment.” Join wrapped lines, remove the line-break hyphen only when dictionary/context supports “document,” then preserve the blank line before the next paragraph.
Common mistakes
Global find-and-replace can merge separate words, remove list indentation, change quoted code, or erase significant non-English characters. Never overwrite the only copy during cleanup.
Practical review checklist
- Record the original input, expected outcome, and test date.
- Repeat the check with a representative edge case before relying on the result.
- Keep the source material and verify the final output independently.
Related WorkShortcut tools
References
Reviewed by WorkShortcut Editorial on June 11, 2026.