How it works

Four rule groups run on every copy, each one against the output of the one before it. That order is not cosmetic: a space only becomes trailing whitespace after an invisible character between it and the line break has been removed, so running the passes in sequence produces a different, better result than running them all at once.

  • Invisibles: Zero-width characters, directionality marks, bidirectional controls and the Unicode tag block are removed outright. The two joiners are handled conditionally: the app looks at both neighbours, sees through skin-tone modifiers and variation selectors, and keeps the joiner wherever it is load-bearing, which is what protects emoji and Indic and Arabic script.
  • Controls: Terminal escape codes, stray control bytes, the delete character, the C1 range and the replacement character all go. Tab, newline and carriage return stay, because text needs them.
  • Whitespace: Exotic spaces become one ordinary space. A run of horizontal whitespace that ends at a line break or at the end of the text is deleted whole rather than converted, and CRLF and lone CR both become a plain newline.
  • Punctuation: Curly quotes straighten, the whole dash family collapses to an ASCII hyphen, the ellipsis becomes three periods, and prime marks become quotes. This is the group that changes text you can see, which is why it is the one most people switch off.

Questions

Does the order really change the result?

Yes. Take a space followed by a zero-width space followed by a newline. Run the passes in order and the invisible character goes first, which turns the space into trailing whitespace, which is then deleted. Run them independently and the space survives. The web cleaner on this site runs the same passes in the same order for exactly this reason.

Can I turn individual groups off?

Yes, each of the groups is independently switchable, and per-application rules decide where cleaning applies at all.