C0 and C1 control codes(Redirected from Device Control 1)
This article needs additional citations for verification. (March 2010) (Learn how and when to remove this template message)
The C0 and C1 control code or control character sets define control codes for use in text by computer systems that use the ISO/IEC 2022 system of specifying control and graphic characters. Most character encodings, in addition to representing printable characters, also have characters such as these that represent additional information about the text, such as the position of a cursor, an instruction to start a new line, or a message that the text has been received.
The C0 set defines codes in the range 00HEX–1FHEX and the C1 set defines codes in the range 80HEX–9FHEX. The default C0 set was originally defined in ISO 646 (ASCII), while the default C1 set was originally defined in ECMA-48 (harmonized later with ISO 6429). While other C0 and C1 sets are available for specialized applications, they are rarely used.
While the C1 control characters are used in conjunction with the ISO/IEC 8859 series of graphical character sets among others, they are rarely used directly, except on specific platforms such as OpenVMS. When they turn up in documents, Web pages, e-mail messages, etc., which are ostensibly in an ISO-8859-n encoding, their code positions generally refer instead to the characters at that position in a proprietary, system-specific encoding such as Windows-1252 or the Apple Macintosh (Mac OS Roman) character set that use the codes provided for representation of the C1 set with a single 8-bit byte to instead provide additional graphic characters, though this is technically invalid under the ISO encodings.
Unicode sets aside 65 code points for compatibility with ISO/IEC 2022. The Unicode control characters cover U+0000—U+001F (C0 controls), U+007F (delete), and U+0080—U+009F (C1 controls). Unicode only specifies semantics for U+001C—U+001F, U+0009—U+000D, and U+0085. The rest of the control characters are transparent to Unicode and their meanings are left to higher-level protocols. The C1 characters in Unicode require 2 bytes to be encoded in UTF-8 (for instance CSI at U+009B is encoded as the bytes 0xC2, 0x9B in UTF-8). Thus the corresponding control functions are more commonly accessed using the equivalent two byte escape sequence intended for use with systems that have only 7-bit bytes.
Protocol interoperability and useEdit
Computer applications dealing with plain text only need to concern themselves with the six format effectors (
0x0D) in the default C0 set. Only HT, LF, and CR are universally well handled. Occasionally BS is used to overprint two characters, and VT and FF are sometimes handled. On the other hand, the C1 control character NEL intended as a single byte substitute for the common two-byte sequence CR LF is often accepted by plain text applications. Very few applications interpret the other C0 and C1 control codes, as they are not needed for plain text.
The ESC code is used extensively to introduce commands to control printing and display devices, for instance in the ANSI escape codes, and Printer Command Language (PCL), the printer language from Hewlett-Packard printers and compatibles.
NUL has the meaning of "end of string" in the programming language C and derivatives such as C++. This meaning is usually not intended in a text stream, but the result is that NUL often cannot be assigned any other meaning.
In addition, some transmission protocols such as ANPA-1312 do make extensive use of control characters SOH, STX, ETX and EOT. Other well known but now nearly obsolete ones are BEL, ACK, NAK and SYN.
The official English language names of some control codes were revised in the most recent edition of the standard for control codes in general (ISO 6429:1992 or ECMA-48:1991) to be neutral with respect to the graphic characters used with them, and to not assume that, as in the Latin script, lines are written on a page from top to bottom and that characters are written on a line from left to right. The abbreviations used were not changed, as the standard had already specified that those would remain unchanged when the standard is translated to other languages. Where the name has been changed, the original name from which the abbreviation was derived is also given in small type in the tables below.
C0 (ASCII and derivatives)Edit
These are the standard ASCII control codes. If using the ISO/IEC 2022 extension mechanism, they are designated as the active C0 control character set with the octet sequence
0x1B 0x21 0x40 (
ESC ! @).
||Originally used to allow gaps to be left on paper tape for edits. Later used for padding after a code that might take a terminal some time to process (e.g. a carriage return or line feed on a printing terminal). Now often used as a string terminator, especially in the programming language C.|
||01||01||SOH||␁||Start of Heading||First character of a message header.|
||02||02||STX||␂||Start of Text||First character of message text, and may be used to terminate the message heading.|
||03||03||ETX||␃||End of Text||Often used as a "break" character (Ctrl-C) to interrupt or terminate a program or process.|
||04||04||EOT||␄||End of Transmission||Often used on Unix to indicate end-of-file on a terminal.|
||05||05||ENQ||␅||Enquiry||Signal intended to trigger a response at the receiving end, to see if it is still present.|
||06||06||ACK||␆||Acknowledge||Response to an ENQ, or an indication of successful receipt of a message.|
||Originally used to sound a bell on the terminal. Later used for a beep on systems that didn't have a physical bell. May also quickly turn on and off inverse video (a visual bell).|
||Move the cursor one position leftwards. On input, this may delete the character to the left of the cursor. On output, where in early computer technology a character once printed could not be erased, the backspace was sometimes used to generate accented characters in ASCII. For example, à could be produced using the three character sequence
||09||09||HT||␉||Character Tabulation, Horizontal Tabulation||
||Position to the next character tab stop.|
||On typewriters, printers, and some terminal emulators, moves the cursor down one row without affecting its column position. On Unix, used to mark end-of-line. In DOS, Windows, and various network standards, LF is used following CR as part of the end-of-line mark.|
||11||0B||VT||␋||Line Tabulation, Vertical Tabulation||
||Position the form at the next line tab stop.|
||On printers, load the next page. Treated as whitespace in many programming languages, and may be used to separate logical divisions in code. In some terminal emulators, it clears the screen. It still appears in some common plain text files as a page break character, such as the RFCs published by IETF.|
||Originally used to move the cursor to column zero while staying on the same line. On classic Mac OS (pre-Mac OS X), as well as in earlier systems such as the Apple II and Commodore 64, used to mark end-of-line. In DOS, Windows, and various network standards, it is used preceding LF as part of the end-of-line mark. The Enter or Return key on a keyboard will send this character, but it may be converted to a different end-of-line sequence by a terminal program.|
||14||0E||SO||␎||Shift Out||Switch to an alternative character set.|
||15||0F||SI||␏||Shift In||Return to regular character set after Shift Out.|
||16||10||DLE||␐||Data Link Escape||Cause the following octets to be interpreted as raw data, not as control codes or graphic characters. Returning to normal usage would be implementation dependent.
||17||11||DC1||␑||Device Control One (XON)||These four control codes are reserved for device control, with the interpretation dependent upon the device they were connected. DC1 and DC2 were intended primarily to indicate activating a device while DC3 and DC4 were intended primarily to indicate pausing or turning off a device. In actual practice DC1 and DC3 (known also as XON and XOFF respectively in this usage) quickly became the de facto standard for software flow control.|
||18||12||DC2||␒||Device Control Two|
||19||13||DC3||␓||Device Control Three (XOFF)|
||20||14||DC4||␔||Device Control Four|
||21||15||NAK||␕||Negative Acknowledge||Sent by a station as a negative response to the station with which the connection has been set up. In binary synchronous communication protocol, the NAK is used to indicate that an error was detected in the previously received block and that the receiver is ready to accept retransmission of that block. In multipoint systems, the NAK is used as the not-ready reply to a poll.|
||22||16||SYN||␖||Synchronous Idle||Used in synchronous transmission systems to provide a signal from which synchronous correction may be achieved between data terminal equipment, particularly when no other character is being transmitted.|
||23||17||ETB||␗||End of Transmission Block||Indicates the end of a transmission block of data when data are divided into such blocks for transmission purposes.|
||24||18||CAN||␘||Cancel||Indicates that the data preceding it are in error or are to be disregarded.|
||25||19||EM||␙||End of medium||Intended as means of indicating on paper or magnetic tapes that the end of the usable portion of the tape had been reached.|
||26||1A||SUB||␚||Substitute||Originally intended for use as a transmission control character to indicate that garbled or invalid characters had been received. It has often been put to use for other purposes when the in-band signaling of errors it provides is unneeded, especially where robust methods of error detection and correction are used, or where errors are expected to be rare enough to make using the character for other purposes advisable. In DOS, Windows and other CP/M derivatives, it is used to indicate the end of file, both when typing on the terminal, and sometimes in text files stored on disk.|
||27||1B||ESC||␛||Escape||\e[b]||The Esc key on the keyboard will cause this character to be sent on most systems. It can be used in software user interfaces to exit from a screen, menu, or mode, or in device-control protocols (e.g., printers and terminals) to signal that what follows is a special command sequence rather than normal text. In systems based on ISO/IEC 2022, even if another set of C0 control codes are used, this octet is required to always represent the escape character.
||28||1C||FS||␜||File Separator||Can be used as delimiters to mark fields of data structures. If used for hierarchical levels, US is the lowest level (dividing plain-text data items), while RS, GS, and FS are of increasing level to divide groups made up of items of the level beneath it.|
|While not technically part of the C0 control character range, the following two characters are defined in ISO/IEC 2022 as always being available regardless of which sets of control characters and graphics characters have been registered. They can be thought of as having some characteristics of control characters.|
|32||20||SP||␠||Space||Space is a graphic character. It has a visual representation consisting of the absence of a graphic symbol. It causes the active position to be advanced by one character position. In some applications, Space can be considered a lowest-level "word separator" to be used with the adjacent separator characters.|
||127||7F||DEL||␡||Delete||Not technically part of the C0 control character range, this was originally used to mark deleted characters on paper tape, since any character could be changed to all ones by punching holes everywhere. On VT100 compatible terminals, this is the character generated by the key labelled ⌫, usually called backspace on modern machines, and does not correspond to the PC delete key.|
These are the most common extended control codes. If using the ISO/IEC 2022 extension mechanism, they are designated as the active C1 control character set with the sequence
0x1B 0x22 0x43 (
ESC " C). Individual control functions can be accessed with the 7-bit equivalents
0x1B 0x40 through
0x1B 0x5F (
ESC @ through
|@||128||80||PAD||Padding Character||Not part of ISO/IEC 6429 (ECMA-48). In early drafts of ISO 10646, was used as part of a proposed mechanism to encode non-ASCII characters. This use was removed in later drafts. Is nonetheless used by the internal-use two-byte fixed-length form of the ISO-2022-based Extended Unix Code (EUC) for left-padding single byte characters in code sets 1 and 3, whereas NUL serves the same function for code sets 0 and 2. This is not done in the usual "packed" EUC format.|
|A||129||81||HOP||High Octet Preset||Not part of ISO/IEC 6429 (ECMA-48). In early drafts of ISO 10646, was intended as a means of introducing a sequence of ISO 2022 compliant multiple byte characters with the same first byte without repeating said first byte, thus reducing length; this behaviour was never part of a standard or published implementation. Its name was nonetheless retained as a RFC 1345 standard code-point name.|
|B||130||82||BPH||Break Permitted Here||Follows a graphic character where a line break is permitted. Roughly equivalent to a soft hyphen except that the means for indicating a line break is not necessarily a hyphen. Not part of the first edition of ISO/IEC 6429. See also zero-width space.|
|C||131||83||NBH||No Break Here||Follows the graphic character that is not to be broken. Not part of the first edition of ISO/IEC 6429. See also word joiner.|
|D||132||84||IND||Index||Move the active position one line down, to eliminate ambiguity about the meaning of LF. Deprecated in 1988 and withdrawn in 1992 from ISO/IEC 6429 (1986 and 1991 respectively for ECMA-48).|
|E||133||85||NEL||Next Line||Equivalent to CR+LF. Used to mark end-of-line on some IBM mainframes.|
|F||134||86||SSA||Start of Selected Area||Used by block-oriented terminals.|
|G||135||87||ESA||End of Selected Area|
|H||136||88||HTS||Character Tabulation Set
Horizontal Tabulation Set
|Causes a character tabulation stop to be set at the active position.|
|I||137||89||HTJ||Character Tabulation With Justification
Horizontal Tabulation With Justification
|Similar to Character Tabulation, except that instead of spaces or lines being placed after the preceding characters until the next tab stop is reached, the spaces or lines are placed preceding the active field so that preceding graphic character is placed just before the next tab stop.|
|J||138||8A||VTS||Line Tabulation Set
Vertical Tabulation Set
|Causes a line tabulation stop to be set at the active position.|
|K||139||8B||PLD||Partial Line Forward
Partial Line Down
|Used to produce subscripts and superscripts in ISO/IEC 6429, e.g., in a printer.
|L||140||8C||PLU||Partial Line Backward
Partial Line Up
|M||141||8D||RI||Reverse Line Feed
|N||142||8E||SS2||Single-Shift 2||Next character invokes a graphic character from the G2 or G3 graphic sets respectively. In systems that conform to ISO/IEC 4873 (ECMA-43), even if a C1 set other than the default is used, these two octets may only be used for this purpose.|
|P||144||90||DCS||Device Control String||Followed by a string of printable characters (0x20 through 0x7E) and format effectors (0x08 through 0x0D), terminated by ST (0x9C).|
|Q||145||91||PU1||Private Use 1||Reserved for a function without standardized meaning for private use as required, subject to the prior agreement of the sender and the recipient of the data.|
|R||146||92||PU2||Private Use 2|
|S||147||93||STS||Set Transmit State|
|T||148||94||CCH||Cancel character||Destructive backspace, intended to eliminate ambiguity about meaning of BS.|
|V||150||96||SPA||Start of Protected Area||Used by block-oriented terminals.|
|W||151||97||EPA||End of Protected Area|
|X||152||98||SOS||Start of String||Followed by a control string terminated by ST (0x9C) that may contain any character except SOS or ST. Not part of the first edition of ISO/IEC 6429.|
|Y||153||99||SGCI||Single Graphic Character Introducer||Not part of ISO/IEC 6429. In early drafts of ISO 10646, was used to encode a single multiple-byte character without switching out of a HOP mode. In later drafts, this facility was removed, the name was nonetheless retained as a RFC 1345 standard code-point name.|
|Z||154||9A||SCI||Single Character Introducer||To be followed by a single printable character (0x20 through 0x7E) or format effector (0x08 through 0x0D). The intent was to provide a means by which a control function or a graphic character that would be available regardless of which graphic or control sets were in use could be defined. Definitions of what the following byte would invoke was never implemented in an international standard. Not part of the first edition of ISO/IEC 6429.|
|[||155||9B||CSI||Control Sequence Introducer||Used to introduce control sequences that take parameters.|
|]||157||9D||OSC||Operating System Command||Followed by a string of printable characters (0x20 through 0x7E) and format effectors (0x08 through 0x0D), terminated by ST (0x9C). These three control codes were intended for use to allow in-band signaling of protocol information, but are rarely used for that purpose.|
|_||159||9F||APC||Application Program Command|
- The name BELL is assigned by Unicode to the unrelated emoji character 🔔 (U+1F514). While C0 and C1 control characters were not formally named by the Unicode standard itself at the time, this collided with existing use of BELL as the name of this control character in software following the previous versions of UTS#18 (the Unicode Regular Expressions standard), e.g. in Perl. Unicode now accepts ALERT and BEL (but not BELL) as formal aliases for the control character, although the code chart still lists BELL as the ISO 6429 alias, and the corresponding control picture codepoint is called SYMBOL FOR BELL. Perl subsequently switched to using BELL for the emoji in version 5.18.
- The '\e' escape sequence is not part of ISO C and many other language specifications. However, it is understood by several compilers, including GCC.
- Williamson, Karl. "Re: PRI #202: Extensions to NameAliases.txt for Unicode 6.1.0".
- Ken Whistler (July 20, 2011). "Formal Name Aliases for Control Characters, L2/11-281". Unicode Consortium.
- "Name Aliases". Unicode Consortium.
- "C0 Controls and Basic Latin" (PDF). Unicode Consortium.
- "charnames". Perl Programming Documentation.
- Ken Whistler (2015-10-05). "Why Nothing Ever Goes Away". Unicode Mailing List.
- Lunde, Ken (2008). CJKV Information Processing: Chinese, Japanese, Korean, and Vietnamese Computing. O'Reilly. p. 244. ISBN 9780596800925.
- "C1 Control Set of ISO 6429:1983, International Register of Coded Character Sets, Registration Number 77" (PDF). Archived from the original (PDF) on 2014-07-01.
- The Unicode Standard
- ATIS Telecom Glossary 2007
- De litteris regentibus C1 quaestiones septem or Are C1 characters legal in XHTML 1.0?
- W3C I18N FAQ: HTML, XHTML, XML and Control Codes
- International register of coded character sets to be used with escape sequences