What “dirty” Bangla usually is
Copying from a PDF, a website, or Facebook often brings zero-width joiners, right-to-left marks, and non-breaking spaces. You cannot see them. Search, spell-check and some converters can. They also inflate a word count and make a seemingly identical string fail a database match.
This cleaner deletes the usual hidden set (ZWSP, ZWNJ, BOM, bidi marks). It collapses repeated spaces and blank lines, trims space before দাঁড়ি and commas, and can normalise curly quotes. Optional digit conversion is off by default because bank references and URLs should stay in English numerals.
It will not magically fix Bijoy text. If the input looks like Latin junk, use the detector and then Bijoy to Unicode. Cleaning ANSI as if it were Unicode just deletes a few symbols and leaves the rest unreadable.
When this does not apply
Do not strip ZWNJ if a typesetter put them in on purpose for a conjunct. Leave bank references and URLs in English digits. After cleaning, recount with the word counter — hidden marks were inflating the number.