In computing and telecommunications, a control character or non-printing character (NPC) is a code point in a character set that does not represent a written character or symbol. They are used as in-band signaling to cause effects other than the addition of a symbol to the text. All other characters are mainly graphic characters, except perhaps for space characters. In the ASCII standard, there are 33 control characters, such as code 7, BEL, which might ring a bell.
History
Prosigns for Morse code are a form of control characters serving functions such as acknowledgement and flow control. A form of control characters were introduced in the 1870 Baudot code: NUL and DEL. The 1901 Murray code added the carriage return (CR) and line feed (LF), and other versions of the Baudot code included other control characters. The bell character (BEL), which rang a bell to alert operators, was also an early teletype control character. Some control characters have also been called "format effectors".
In ASCII
There were quite a few control characters defined (33 in ASCII, and ECMA-35 adds 32 more). This was because early terminals had very primitive mechanical or electrical controls that made any kind of state-remembering API quite expensive to implement, thus a different code for each and every function was a requirement. All entries in the ASCII table below code 3210 (technically the C0 control code set) are control characters, including CR and LF used to separate lines of text. The code 12710 (DEL) is also a control character. Extended ASCII sets defined by ECMA-35 and ISO 8859 added the codes 12810 through 15910 as control characters. This was primarily done so that if the high bit was stripped, it would not change a printing character to a C0 control code. This second set is called the C1 set. IBM's EBCDIC character set contains 65 control codes, including all of the ASCII C0 control codes plus additional codes which were not added to Unicode. There were also a number of attempts to define alternative sets of 32 control codes, none of these were transferred to Unicode either. Only a small subset of the control characters are still in use for anything resembling their original purpose:
0x00 (null, NUL, \0, ^@), originally intended to be an ignored character, but now used by many programming languages including C to mark the end of a string. 0x04 (EOT, ^D) End Of File character on Unix terminals. 0x07 (bell, BEL, \a, ^G), which may cause the device to emit a warning such as a bell or beep sound or the screen flashing. 0x08 (backspace, BS, \b, ^H), may overprint the previous character. 0x09 (horizontal tab, HT, \t, ^I), moves the printing position right to the next tab stop. 0x0A (line feed, LF, \n, ^J), moves the print head down one line (and maybe to the left edge). Used as the end of line marker in Unix-like systems. 0x0B (vertical tab, VT, \v, ^K), vertical tabulation. 0x0C (form feed, FF, \f, ^L), to cause a printer to eject paper to the top of the next page, or a video terminal to clear the screen. 0x0D (carriage return, CR, \r, ^M), moves the printing position to the start of the line, allowing overprinting. Used as the end of line marker in Classic Mac OS, OS-9, FLEX (and variants). A CR+LF pair is used by CP/M-80 and its derivatives including MS-DOS and Windows. 0x1B (escape, ESC, \e (GCC only), ^[). Introduces an escape sequence. 0x1C (file separator, FS, ^\) ISO/IEC 10538 uses this as a "document terminator" code to indicate the end of text in a document. 0x1D (group separator, GS, ^]) ISO/IEC 10538 uses this as a "page terminator" code to indicate the end of text on a page. Control characters may do something when the user inputs them, such as Ctrl+C (End-of-Text character, ETX) to interrupt the running process, and Ctrl+Z (Substitute character, SUB) for ending typed-in file on Windows. These uses usually have little to do with their ASCII definition. Modern systems often describe shortcuts as though they are control characters ("type a Ctrl+V to paste") but the code number is not even used to implement this.
In Unicode
These 65 control codes were carried over to Unicode. "Control-characters" are U+0000—U+001F (C0 controls), U+007F (delete), and U+0080—U+009F (C1 controls). Their General Category is "Cc". The Cc control characters have no Name in Unicode, but are given labels such as "<control-001A>" instead. Unicode added more characters (such as the zero-width non-joiner) that could be considered controls, but it makes a distinction between these "Formatting characters" and the 65 control characters. These are General Category "Cf" instead of "Cc".
Display There are a number of techniques to display non-printing characters, which may be illustrated with the bell character in ASCII encoding:
Caret notation in ASCII using the nth letter of the alphabet: ^G An escape sequence, as in C/C++ character string codes: \a, \007, \x07, etc. An abbreviation, often three capital letters: BEL A Unicode character from the Control Pictures Unicode block that condenses the abbreviation: U+2407 ␇ SYMBOL FOR BELL An ISO 2047 graphical representation: U+237E ⍾ BELL SYMBOL
… excerpt ends here. Continue reading the full article.
