cleanpaste-normalizer is a deterministic, local Python utility for standardizing clipboard and pasted text. It handles common encoding and spacing inconsistencies across operating systems and rich-text editors without altering actual wording.
- Normalizes line endings to standard Unix newlines (
\n). - Applies Unicode NFKC normalization.
- Replaces non-breaking spaces (NBSP), zero-width characters, and irregular whitespace.
- Expands or normalizes tabs and strips trailing whitespace.
- Operates purely in-memory with standard library routines.
- Preserves ordinary text, casing, and semantic structure without automated rewriting.
- Does not upload content, contact external endpoints, or log inputs.
The public interface consists of a single function: normalize_pasted_text(text: str).
from cleanpaste_normalizer import normalize_pasted_text
raw_text = "First line\r\nSecond line with non-breaking\u00a0space and zero-width\u200bchar. "
normalized = normalize_pasted_text(raw_text)
print(normalized)The CLI accepts an optional positional UTF-8 filename or reads directly from standard input:
# Process a local file directly
cleanpaste-normalizer raw_input.txt
# Process input from stdin
cat raw_input.txt | cleanpaste-normalizerAll execution is local and synchronous with zero network traffic.
To verify behavior across Unicode test fixtures, run:
pytestTo explore browser-based normalization tools and background guidelines, visit the CleanPaste text tools page. Package distribution metadata may link to this project homepage.
Distributed under the MIT License.
This package provides normalizePastedText. The related web tool is https://cleanpasteai.com/. All processing runs locally without uploading input data.