Text / Review
Safely Cleaning Hidden Characters and Formatting Residue from AI-Assisted Text: Principles and an Automated Review Flow
Zero-width spaces, BOMs, soft hyphens, Markdown residue, and tracking parameters break search, regex, and diffs. How Unicode classifies them, a four-step review flow with NoAITell's local scanner, and a batch-detection script for CI.
Start with the scope. “Hidden characters” here means characters that are invisible but real: zero-width spaces, byte-order marks, soft hyphens, no-break spaces, plus the Markdown residue and URL tracking parameters that come along when you copy out of an AI tool or a rich-text editor. This is not a guide to evading AI detection. NoAITell is explicit about its own limits: it does not paraphrase, does not verify or remove so-called statistical watermarks, and cannot determine authorship from punctuation. What it does is plainer and more useful: it finds the characters that break things and leaves the decision to you.
Where they come from
- Copying from a chat window. Model output frequently carries zero-width spaces (U+200B), zero-width joiners (U+200D), and unusual quotes and dashes.
- Pasting from web pages or documents. Content systems swap normal spaces for no-break spaces (U+00A0) and insert soft hyphens (U+00AD) for automatic line breaking.
- Cross-platform editors. Tools like Windows Notepad add a BOM (U+FEFF) on save; line endings flip between CRLF and LF.
- Exporting from AI tools. Leftover
**,##,\*Markdown markers, and links carrying longutm_*andfbclidparameter chains.
Why they are a problem
A single zero-width space makes two strings that “look identical” compare as different. The fallout: search misses, regex fails, git diff reports whole lines as changed with no visible difference, string comparisons in code quietly fail, and screen readers insert odd pauses. They are not a security hole, but they are a productivity sink.
The principle: which Unicode classes they live in
Unicode sorts characters into categories. Two matter here:
- Format characters (Cf): zero-width spaces, zero-width joiners, BOMs, and soft hyphens. They exist to control rendering and have no glyph.
- Space separators (Zs): the normal space, the no-break space, and the various-width spaces.
Modern regex engines match by category: JavaScript with the u flag accepts \p{Cf} and \p{Zs}; PCRE supports them natively; Python’s standard re does not support the syntax, so you need the third-party regex module. To see exactly what sits at a suspicious position, paste the text into Regex101 with the PCRE or JS flavor and read the token-by-token explanation on the right.
The review flow: scan, read the diff, then decide
The flow we use has four steps, and the principle behind all of them is every judgment stays with a human:
- Scan locally. Paste the text into NoAITell (the free tier allows up to 500 words per cleaning, three times a day; scanning and reviewing do not count). It runs entirely in the browser and never uploads the text. You can confirm this yourself: open the developer tools’ Network panel and watch that no request goes out.
- Read the findings. Results are grouped: invisible characters, Markdown residue, whitespace and known tracking parameters, and “style hints” (repeated dashes, stock openers such as “it is important to note”).
- Tick only the fixes you agree with. The first three groups are deterministic cleanups. The fourth is an editing cue, not evidence; whether to act on it is your call.
- Review the diff, then copy. After applying fixes, read the before/after view to make sure nothing meaningful was removed (spaces inside code, for instance), then copy out.
Batch detection with a script
NoAITell handles one passage at a time. To audit a whole directory of Markdown, a dozen lines of script are a better fit. This Node.js snippet reports the position of every format character and no-break space per file:
import { readFileSync, readdirSync } from "node:fs";
import { join } from "node:path";
const dir = process.argv[2] || ".";
const pattern = /[\p{Cf}\u00A0]/gu;
const names = { "\u200B": "ZERO WIDTH SPACE", "\u200D": "ZERO WIDTH JOINER", "\uFEFF": "BOM", "\u00AD": "SOFT HYPHEN", "\u00A0": "NO-BREAK SPACE" };
for (const file of readdirSync(dir).filter((f) => f.endsWith(".md"))) {
const text = readFileSync(join(dir, file), "utf8");
const lines = text.split("\n");
lines.forEach((line, i) => {
const hits = line.match(pattern) || [];
if (hits.length) console.log(`${file}:${i + 1} ${[...new Set(hits)].map((c) => names[c] || `U+${c.codePointAt(0).toString(16).toUpperCase()}`).join(", ")}`);
});
}
Drop it into continuous integration and any file that introduces one of these characters gets flagged before merge. Note that it reports and never edits. Like NoAITell, the change is yours to make.
Style hints are clues, not verdicts
Stock openers (“it is important to note”, “in conclusion”, “not only … but also”) do make prose feel formulaic, and strings of em dashes are often read as an “AI tell”. But these are clues about writing habits, not evidence of who wrote what. NoAITell flags them to say “this paragraph could be more direct”, not to classify the text. Using the feature to improve expression is right; using it to “prove” or “disprove” AI authorship is a misuse.
Boundaries and ethics
- No rewriting. Cleanup tools handle characters and formatting only. Rewriting is your job, and the reason your name is on it.
- No promise of beating detectors. Any tool claiming to “remove AI traces and pass detection” deserves suspicion; NoAITell says plainly that it cannot.
- Keep meaningful formatting. Spaces in code and a no-break space between a number and its unit are deliberate. Read the context before a bulk replace.
- Work on text you have the right to work on. Cleaning your own draft is fine; using it to launder someone else’s content is a different matter.
Checklist
- Scan locally before pasting into the editor
- Confirm in the Network panel that nothing uploaded
- Tick all deterministic fixes; judge style hints yourself
- Review the diff before copying
- Add a batch-detection script to the repository
- Do not strip the no-break space in code or between numbers and units
Make these a habit and “they look the same but won’t match” largely disappears from your workflow.