Control characters: C0, DEL and C1

The non-printing bytes below the printable ASCII range, the delete character, and the C1 range above it. They were designed to control teleprinters and terminals rather than to represent text.

How it works

The C0 range below 0x20, the delete character at 0x7F, and the C1 range from 0x80 to 0x9F were designed to control devices rather than to represent text: to ring a bell, advance a printer, or introduce an escape sequence. Terminal escape sequences begin with 0x1B and are followed by a bracket and parameters, which is how colour and cursor movement travel through a terminal stream. Copying from a terminal can carry those sequences into a document, where they either render as visible garbage or vanish while still occupying bytes. A null byte at 0x00 is worse in any language that treats it as a string terminator, since the value silently truncates. Three of the range are indispensable and stay: tab, line feed and carriage return.

What it is legitimately for

Tab, newline and carriage return are indispensable. The rest have no business in a document: an escape character belongs in a terminal stream, not in a paragraph.

What it breaks

  • An escape sequence copied from a terminal carries colour codes into a document, where they render as garbage or as nothing at all.
  • A null byte truncates a string in any language that treats it as a terminator.
  • A stray control byte in a CSV or a database field produces errors far away from the cause.

How to find it yourself

A hex dump is the only reliable way; most editors render these as nothing or as a placeholder box.

What Clipboard Sanitizer does

Removed, except tab, newline and carriage return, which are kept because text needs them.