C0 And C1 Control Codes
   HOME

TheInfoList



OR:

The C0 and C1 control code or
control character In computing and telecommunication, a control Character (computing), character or non-printing character (NPC) is a code point (a number) in a character encoding, character set, that does not represent a written symbol. They are used as in-band ...
sets define control codes for use in text by computer systems that use
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
and derivatives of ASCII. The codes 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. C0 codes are the range 00 HEX–1FHEX and the default C0 set was originally defined in
ISO 646 ISO/IEC 646 is a set of ISO/IEC standards, described as ''Information technology — ISO 7-bit coded character set for information interchange'' and developed in cooperation with ASCII at least since 1964. Since its first edition in ...
(
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
). C1 codes are the range 80HEX–9FHEX and the default C1 set was originally defined in ECMA-48 (harmonized later with ISO 6429). The
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
system of specifying control and graphic characters allows other C0 and C1 sets to be available for specialized applications, but they are rarely used.


C0 controls

ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
defined 32 control characters, plus a necessary extra character for the DEL character, 7FHEX or 01111111BIN (needed to punch out all the holes on a paper tape and erase it). This large number of codes was desirable at the time, as multi-byte controls would require implementation of a state machine in the terminal, which was very difficult with contemporary electronics and mechanical terminals. Since then, only a few of the original controls have maintained their use: the "whitespace" range of BS, TAB, LF, VT, FF, and CR; the BEL code; and ESC (but almost always as part of an ESC,' __representation_starting_an_ANSI_escape_sequence).__Others_are_unused_or_have_acquired_different_meanings_such_as_NUL_being_the_C_(programming_language).html" ;"title="ANSI_escape_sequence.html" ;"title=" representation starting an ANSI escape sequence"> representation starting an ANSI escape sequence). Others are unused or have acquired different meanings such as NUL being the C (programming language)">C string terminator. Some serial transmission protocols such as ANPA-1312, Kermit (protocol), Kermit, and XMODEM do make extensive use of control characters SOH, STX, ETX, EOT, ACK, NAK and SYN for purposes approximating their original definitions.


Basic ASCII control codes

These are the standard ASCII control codes, originally defined in
ANSI X3.4 ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
. If using the
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
extension mechanism, they are designated as the active C0 control character set with the octet sequence 0x1B 0x21 0x40 (ESC ! @).


Category-Number names

Several of the basic ASCII control codes are classified into a few categories, and sometimes given alternative abbreviated names consisting of that category and a number: * Transmission controls: TC1 (SOH), TC2 (STX), TC3 (ETX), TC4 (EOT), TC5 (ENQ), TC6 (ACK), TC7 (DLE), TC8 (NAK), TC9 (SYN), TC10 (ETB). * Format effectors: FE0 (BS), FE1 (HT), FE2 (LF), FE3 (VT), FE4 (FF), FE5 (CR). * Device controls: DC1, DC2, DC3, DC4. * Information separators: IS1 (US), IS2 (RS), IS3 (GS), IS4 (FS). * Locking shifts: LS0 (SI), LS1 (SO). * Others: NUL, BEL, CAN, EM, SUB, ESC.
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
(ECMA-35) refers to the C0 locking shifts as LS0 and LS1 in 8-bit environments, and as SI and SO in 7-bit environments. The first, 1963 edition of ASCII classified as a device control, rather than a transmission control, and gave it the abbreviation DC0 ("device control reserved for data link escape"). Format (FE) codes define and actuate formatting (such as line breaks) which affects how graphical characters are laid out and rendered, as opposed to controlling other functions of hardware devices or having other side effects. The C0 format effectors are permitted in ISO/IEC 6429 , , and sequences. The information separators and C0 format effectors (minus ) are the only C0 control codes with semantics defined by the Unicode Standard, the interpretation of the remainder of the C0 controls being left to higher-level protocols. ISO/IEC 2022 (ECMA-35) requires that if C0 control code sets include the ten ASCII transmission control (TC) codes, they must be encoded at their ASCII locations. It also prohibits those ten transmission controls from being included in a C1 control code set, and prohibits transmission controls besides those ten from being included in a C0 control set.


Modified C0 control code sets

Although C0 control code sets usually preserve most of the ASCII control codes unchanged, a number are registered which replace certain control functions with alternatives. A selection of these, excluding those related to Videotex, are shown below.


Other C0 control code sets

Teletext A British Ceefax football index page from October 2009, showing the three-digit page numbers for a variety of football news stories Teletext, or broadcast teletext, is a standard for displaying text and rudimentary graphics on suitably equipp ...
defines an entirely different set of control codes. In formats where compatibility with ECMA-48's C0 control codes is not required, these control codes are sometimes mapped transparently to the Unicode C0 control code range (U+0000 through U+001F).


C1 controls

In parallel to the development of the 1972 edition of
ISO 646 ISO/IEC 646 is a set of ISO/IEC standards, described as ''Information technology — ISO 7-bit coded character set for information interchange'' and developed in cooperation with ASCII at least since 1964. Since its first edition in ...
, which revised the standard to introduce the concept of national versions of the code in addition to the US-originated ASCII, work was also underway with the purpose of defining extension mechanisms for ASCII, applicable to both 7-bit and 8-bit environments, which would be published as ECMA-35 and
ISO 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/ IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
. These mechanisms were designed so that any conformant 8-bit code could be converted to a corresponding 7-bit code, and ''vice versa''. In a 7-bit environment, the Shift Out () control would change the meaning of the 94 bytes 0x21 through 0x7E (i.e. the graphical codes, excluding the space) to invoke characters from an alternative set, and the Shift In () control would change them back. In an 8-bit environment, instead of using shift codes, the eighth bit was set on a byte referencing the additional graphic character set. This meant that bytes 0xA1 through 0xFE were used for the additional graphic characters. The C0 control characters, being unaffected by the shift state of a 7-bit code, were to always be represented in an 8-bit code with the eighth bit unset. The consequently otherwise-unused bytes in the range 0x80 through 0x9F could be used for additional control codes, which would instead be represented as 0x1B 0x40 through 0x1B 0x5F (ESC @ through ESC _) in a 7-bit code. These additional control codes become known as the C1 control codes. To retain compatibility with the 7-bit representation, the behaviour of bytes 0xA0 and 0xFF was originally left undefined. The first C1 control code set to be registered for use with ISO 2022 was
DIN 31626 The C0 and C1 control code or control character sets define control codes for use in text by computer systems that use ASCII and derivatives of ASCII. The codes represent additional information about the text, such as the position of a cursor, ...
, a specialised set for bibliographic use which was registered in 1979. The general-use ISO/IEC 6429 set was registered in 1983, although the ECMA-48 specification upon which it was based had been first published in 1976. Further editions of the standards altered the provisions to an extent. For instance, a further revision to ECMA-35 and ISO 2022 in 1985 introduced the concept of a 96-code graphical character set. In an 8-bit code, this allowed the entire range from 0xA0 to 0xFF to be used for graphical characters. Use of 96-code sets also meant that the meaning of the bytes 0x20 and 0x7F in the corresponding 7-bit code could differ from "Space" and "Delete", unless the code was in the Shift In state. Using 96-code sets for the G0 (Shift In) set was not made possible. In accordance with this revised 8-bit ISO 2022 code structure,
ISO 8859 ISO/IEC 8859 is a joint ISO and IEC series of standards for 8-bit character encodings. The series of standards consists of numbered parts, such as ISO/IEC 8859-1, ISO/IEC 8859-2, etc. There are 15 parts, excluding the abandoned ISO/IEC 8859-12 ...
defines sets of characters to be encoded over 0xA0–FF, in combination with the ASCII graphical characters over 0x20–7E, and reserves the bytes outside of these ranges for use as non-graphical codes by other specifications such as ISO/IEC 6429. Unicode inherits its first 256 code points from ISO 8859-1, hence also incorporating a range reserved for a C1 control code set, although it mostly leaves their function to be defined by higher level protocols, with
ISO/IEC 6429 ISO/IEC JTC 1, entitled "Information technology", is a joint technical committee (JTC) of the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC). Its purpose is to develop, maintain and p ...
suggested as a default.


C1 control codes for general use

These are the most common extended control codes, and are defined in
ISO/IEC 6429 ISO/IEC JTC 1, entitled "Information technology", is a joint technical committee (JTC) of the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC). Its purpose is to develop, maintain and p ...
, ECMA-48 and
JIS X 0211 JIS X 0211, originally designated JIS C 6323 is a Japanese Industrial Standard defining C0 and C1 control codes and control sequences. It was first established in 1986, with subsequent editions in 1991 and 1994. It defines C0 and C1 control charac ...
(formerly JIS C 6323). If using the
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
extension mechanism, they are designated as the active C1 control character set with the sequence 0x1B 0x22 0x43 (ESC " C). Although
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
does not require a particular C1 control code set, leaving their interpretation to be specified by higher-level protocols, and only specifies a behaviour for U+0085, it suggests interpreting C1 control codes as specified in ISO/IEC 6429 in the absence of use for other purposes. Also listed in the table below are three control codes listed alongside the ISO/IEC 6429 codes in , but not actually defined by ISO/IEC 6429 (, and ). Except for and in
EUC-JP Extended Unix Code (EUC) is a multibyte character encoding system used primarily for Japanese, Korean, and simplified Chinese. The most commonly used EUC codes are variable-length encodings with a character belonging to an compliant coded char ...
text, and in text transcoded from
EBCDIC Extended Binary Coded Decimal Interchange Code (EBCDIC; ) is an eight-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding six- ...
, the 8-bit forms of these codes are almost never used. , and are used to control
text terminal A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. The teletype was an example of an early-day hard-copy terminal and ...
s and
terminal emulator A terminal emulator, or terminal application, is a computer program that emulates a video terminal within some other display architecture. Though typically synonymous with a shell or text terminal, the term ''terminal'' covers all remote termin ...
s, but almost always by using their 7-bit escape code representations. Their
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
compliant single-byte representations are invalid in
UTF-8 UTF-8 is a variable-width encoding, variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit'' ...
, and the UTF-8 encodings of their corresponding codepoints are two bytes long like their escape code forms (for instance, CSI at U+009B is encoded as the bytes 0xC2, 0x9B in UTF-8), so there is no advantage to using them rather than the equivalent two-byte escape sequence. When these codes appear in modern documents, web pages, e-mail messages, etc., they are usually intended to be printing characters at that position in a proprietary encoding such as
Windows-1252 Windows-1252 or CP-1252 ( code page 1252) is a single-byte character encoding of the Latin alphabet, used by default in the legacy components of Microsoft Windows for English and many European languages including Spanish, French, and German. It ...
or
Mac OS Roman Mac OS Roman is a character encoding created by Apple Computer, Inc. for use by Macintosh computers. It is suitable for representing text in English and several other Western languages. Mac OS Roman encodes 256 characters, the first 128 of which ...
that use the C1 codes to provide additional graphic characters. The official English language names of some C1 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 parenthesis in the tables below.


C1 control codes for bibliographic use

The following alternative C1 control code set is defined for bibliographic applications such as library systems. It is mostly concerned with string collation, and with markup of bibliographic fields. Slightly different variants are defined in the German standard DIN 31626 (published in 1978 and since withdrawn) and the
ISO ISO is the most common abbreviation for the International Organization for Standardization. ISO or Iso may also refer to: Business and finance * Iso (supermarket), a chain of Danish supermarkets incorporated into the SuperBest chain in 2007 * Iso ...
standard ISO 6630, the latter of which has also been adopted in Germany as DIN ISO 6630. Where these differ is noted in the table below where applicable. MARC-8 uses the coding of and from this set, and adds some additional format effectors in locations not used by the ISO version; however, MARC 21 uses this control set only in MARC-8 records, not in Unicode-format records. If using the
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
extension mechanism, the DIN 31626 set is designated as the active C1 control character set with the sequence 0x1B 0x22 0x45 (ESC " E), and the ISO 6630 / DIN ISO 6630 set is designated with the sequence 0x1B 0x22 0x42 (ESC " B). The 1985 expansion of the ISO 6630 set can also be explicitly specified by using the sequence 0x1B 0x26 0x40 0x1B 0x22 0x42 (ESC & @ ESC " B).


Other C1 control code sets

EBCDIC Extended Binary Coded Decimal Interchange Code (EBCDIC; ) is an eight-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding six- ...
defines 16 additional control codes, besides those present in ASCII. When mapped to
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
or to
ISO 8859 ISO/IEC 8859 is a joint ISO and IEC series of standards for 8-bit character encodings. The series of standards consists of numbered parts, such as ISO/IEC 8859-1, ISO/IEC 8859-2, etc. There are 15 parts, excluding the abandoned ISO/IEC 8859-12 ...
, these codes are mapped to C1 control characters in a manner specified by IBM's Character Data Representation Architecture (CDRA). Although the default mapping of the New Line (NL) control does correspond to the ISO/IEC 6429 (0x85; although its mapping is sometimes swapped with LF, following UNIX line ending convention), the remainder of the control codes do not correspond to ISO/IEC 6429. For example, the EBCDIC control (0x09, mapped to 0x8D) and the ECMA-48 control (0x8C) are both used to begin a superscript or end a subscript, but are not mapped to one another. Extended-ASCII-mapped EBCDIC can therefore be regarded as having its own C1 set, although it is not registered with the
ISO-IR ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/ IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
registry for use with
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
. Various specialised C1 control code sets are registered for use by various
Videotex Videotex (or interactive videotex) was one of the earliest implementations of an end-user information system. From the late 1970s to early 2010s, it was used to deliver information (usually pages of text) to a user in computer-like format, typi ...
formats.


Unicode

Unicode sets aside 65 code points in the general category (control) for compatibility with
ISO/IEC 2022 ISO/IEC 2022 ''Information technology—Character code structure and extension techniques'', is an ISO/IEC standard (equivalent to the ECMA standard ECMA-35, the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202) in the ...
. These are: * U+0000–U+001F (C0 controls) and U+007F (delete) assigned to the Basic Latin
block Block or blocked may refer to: Arts, entertainment and media Broadcasting * Block programming, the result of a programming strategy in broadcasting * W242BX, a radio station licensed to Greenville, South Carolina, United States known as ''96.3 ...
, and * U+0080–U+009F (C1 controls) assigned to the
Latin-1 Supplement The Latin-1 Supplement (also called C1 Controls and Latin-1 Supplement) is the second Unicode block in the Unicode standard. It encodes the upper range of ISO 8859-1: 80 (U+0080) - FF (U+00FF). C1 Controls (0080–009F) are not graphic. Thi ...
block. Unicode only specifies semantics for U+0009–U+000D, U+001C–U+001F, and U+0085. The rest of the control codes are transparent to Unicode and their meanings are left to higher-level protocols. Besides these, Unicode include additional format effector characters besides these, such as marks, embeds, isolates and pops for explicit bidirectional formatting, and the
zero-width joiner The zero-width joiner (ZWJ, ) is a non-printing character used in the computerized typesetting of writing systems in which the shape or positioning of a grapheme depends on its relation to other graphemes ( complex scripts), such as the Arabic s ...
and non-joiner for controlling ligature use. However these are given the general category (format) rather than .


See also

*
Control Pictures Control Pictures is a Unicode block A Unicode block is one of several contiguous ranges of numeric character codes ( code points) of the Unicode character set that are defined by the Unicode Consortium for administrative and documentation purpos ...
*
ANSI escape code ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape charac ...


Footnotes


References

* The Unicode Standard *
C0 Controls and Basic Latin
*
C1 Controls and Latin-1 Supplement
*
Control Pictures
** The Unicode Standard, Version 6.1.0
Chapter 16: Special Areas and Format Characters

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
{{character encoding Control characters de:Steuerzeichen