lulupedia
Bikol Central 版本暂未收录,当前展示 English 内容。

Control character

5158 words·9/24/2026·English
0

In computing and telecommunications, a control character is a code point in a character set (such as ASCII or Unicode) that does not represent a printable symbol but instead initiates, modifies, or terminates a control function, typically affecting the behavior of a device, a data stream, or a communication protocol.

History

Control characters originated in the early days of telegraphy and were later formalized in the ASCII standard (American Standard Code for Information Interchange) in the 1960s. The original telegraph systems used characters such as "line feed" and "carriage return" to control the movement of paper in teleprinters. ASCII reserved the first 32 code points (0–31, decimal) and the DEL code (127) for control functions, while later standards such as ISO/IEC 646 and Unicode extended this concept to include additional control sets like the C1 set (128–159 in ISO 8859 and Unicode).

C0 Control Characters (ASCII)

The ASCII control characters (code points 0–31) are collectively known as the C0 set. They are grouped by function:

  • Transmission control (e.g., STX, ETX, ACK, NAK): Used to manage data flow, framing, and error detection in serial communication protocols.
  • Format effectors (e.g., BS, HT, LF, FF, CR): Control the layout of text on output devices, such as moving the cursor, advancing paper, or inserting tabs.
  • Information separators (e.g., FS, GS, RS, US): Used to delimit logical records or fields in data streams.
  • Device control (e.g., DC1–DC4): Historically employed to turn attached peripherals on and off (e.g., DC1 for "XON", DC3 for "XOFF").
  • Others: NUL (null character) for padding, BEL (bell) to produce an audible alert, and ESC to introduce escape sequences.

The DEL character (code 127) is considered a control character as well, originally used to delete a previously punched hole in paper tape.

C1 Control Characters

In extensions such as ISO/IEC 6429 (ECMA-48), the C1 control set occupies code points 128–159 (0x80–0x9F) in 8-bit character encodings. Unicode also reserves this range for control characters. Notable C1 codes include:

  • IND (Index), NEL (Next Line): Analogues to line feed and newline.
  • HTS (Horizontal Tab Set), VTS (Vertical Tab Set): Set tab stops.
  • CSI (Control Sequence Introducer): Initiates ANSI escape sequences used in terminal control (e.g., cursor movement, color changes).
  • SPA (Start of Protected Area), EPA (End of Protected Area): Used in word-processing and terminal emulation.

In Unicode, C1 characters are explicitly defined but are rarely used directly in modern text; they are often replaced by equivalent escape sequences or markup.

Control Characters in Unicode

Unicode preserves the C0 and C1 control characters for backward compatibility, but it also includes additional dedicated control-like characters such as:

  • U+200B ZERO WIDTH SPACE: A formatting control that allows line breaks without visible spacing.
  • U+200C ZERO WIDTH NON-JOINER: Prevents cursive joining in scripts like Arabic.
  • U+FEFF BYTE ORDER MARK (BOM): Used at the start of a text stream to indicate byte order or encoding; also acts as a zero-width non-breaking space.

Unicode also defines ISO 14651/UCA controls for collation and directional formatting characters (e.g., U+202A LEFT-TO-RIGHT EMBEDDING) for bidirectional text. These are sometimes classified as "format characters" rather than traditional control characters.

Usage

Control characters are essential in many contexts:

  • Terminal emulation: Escape sequences (starting with ESC) control cursor position, screen clearing, text attributes, and color.
  • Serial communication: Protocols like XON/XOFF use DC1 and DC3 for flow control; ASCII ACK/NAK are used in error detection.
  • Data delimiters: In formats such as CSV or log files, Information Separators (RS, GS, US) occasionally serve as field or record separators.
  • Text processing: The line feed (LF, U+000A) and carriage return (CR, U+000D) define newlines in different operating systems (Unix vs. Windows vs. classic Mac OS).
  • Punched tape and legacy media: NUL and DEL were used for padding and deletion in physical tape.

Examples of Common Control Characters

| Code (dec) | Name | Abbreviation | Typical Use |
|------------|---------------------------|--------------|--------------------------------------|
| 0 | Null | NUL | Padding, string terminator in C |
| 7 | Bell | BEL | Audible alert on terminals |
| 8 | Backspace | BS | Move cursor left one position |
| 9 | Horizontal Tab | HT | Advance to next tab stop |
| 10 | Line Feed | LF | Move cursor down one line (Unix newline) |
| 12 | Form Feed | FF | Eject page or clear screen |
| 13 | Carriage Return | CR | Return cursor to beginning of line |
| 26 | Substitute | SUB | End-of-file marker in some systems |
| 27 | Escape | ESC | Start escape sequence |
| 127 | Delete | DEL | Delete previous character; nothing in ASCII terminal |

Modern Context and Challenges

As computing evolved, many historical control functions became obsolete or absorbed into higher-level protocols. In modern software:

  • Control characters are often displayed as visual placeholders (e.g., ^C for ETX) or handled invisibly by user interfaces.
  • The distinction between "control" and "formatting" characters has blurred. For example, Unicode format characters like the soft hyphen (U+00AD) enable invisible line-breaking hints, while zero-width spaces influence word-breaking without any visible glyph.
  • Security concerns arise when control characters are embedded in user-generated text (e.g., injected escape sequences in terminal emulators leading to "terminal injection" attacks).
  • Some legacy control characters (e.g., the C1 set) are deprecated in favor of Unicode markup like directional overrides and explicit formatting tags.

Despite their declining visibility, control characters remain a fundamental part of character encoding standards and continue to be used in system-level programming, text protocols, and internationalized text processing.

Comments (0)

U

No comments yet. Be the first to comment!

You May Be Interested In

Related Articles