C0 and C1 control codes


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, an instruction to start a new line, or a message that the text has been received.
C0 codes are the range 00HEX-1FHEX and the default C0 set was originally defined in ISO 646. C1 codes are the range 80HEX-9FHEX and the default C1 set was originally defined in ECMA-48. The ISO/IEC 2022 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

defined 32 control characters, plus a necessary extra one for the all-1 DEL character.
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. Others are unused or have acquired different meanings such as NUL being the C string terminator.
Some serial transmission protocols such as ANPA-1312, 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. 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.

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:
ISO/IEC 2022 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.
Format effector codes affect 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 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 requires that if C0 control code sets include the ten ASCII transmission control 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:
SeqDecHexReplacedIn code setAcronymNameDescription
^I0909HTNATS, IPTCFOFormattingUsed in tabular data to move to the next tabulation position, and in standard formats to denote the next phase. The current IPTC specification instead recommends using regular ASCII C0 controls, and using the control as a column break in tables.
^K110BVTNATS, IPTCECDEnd of InstructionDelimits the end of a typographical instruction intended for the typesetting device.
^L120CFFNATS, IPTCSCDStart of InstructionDelimits the start of a typographical instruction intended for the typesetting device.
^M130DCRNATS, IPTCQLQuad LeftTerminates a line, indicating that it should be left-aligned. The current IPTC specification instead recommends using regular ASCII C0 controls, and representing this function with the sequence.
^N140ESONATSURUpper RailStarts an emphasised region of text. Used in Scandinavian journalistic text transmission as of 1975; IPTC recommendations as of 1976 used FT2 and FT3 instead. The current IPTC specification instead recommends using regular ASCII C0 controls, and marking up this function with the character.
^O150FSINATSLRLower RailEnds an emphasised region of text. Used in Scandinavian journalistic text transmission as of 1975; IPTC recommendations as of 1976 used FT1 instead. The current IPTC specification instead recommends using regular ASCII C0 controls, and marking up this function with the character.
^Q1711DC1IPTCFT1Font OneSwitches to regular typeface, i.e. disables bold or italic.
^R1812DC2IPTCFT2Font TwoSwitches to italic typeface.
^S1913DC3IPTCFT3Font ThreeSwitches to bold typeface.
^X2418CANNATS, IPTCKWKill WordDeletes the preceding word. Retains "Cancel" semantics in this respect, but has a more specific function.
^Y2519EMT.61/T.51, StandaloneSS2Single Shift Two; a C0 representation allowing it to be represented with one byte in a 7-bit environment.
^\281CFSNATS, IPTC, StandaloneSS/SS2Super Shift or Single Shift Two.
^\281CFSJIS C 6225CEXControl ExtensionIntroduces a control sequence as specified by the now-withdrawn JIS C 6225. These included sequences for controlling vertical text behaviour, superscripts and subscripts.
^]291DGSNATS, IPTCQCQuad CentreTerminates a line, indicating that it should be centred.
^]291DGST.61/T.51SS3Single Shift Three; a C0 representation allowing it to be represented with one byte in a 7-bit environment.
^^301ERSNATS, IPTCQRQuad RightTerminates a line, indicating that it should be right-aligned.
^_311FUSNATS, IPTCJYJustifyTerminates a line which is to be justified.

C1 controls

In parallel to the development of the 1972 edition of ISO 646, 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.
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 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 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, 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 set was not made possible.
It was this 8-bit code structure, with the bytes with the eighth bit set being divided between a range of C1 control codes and a 96-code set of graphical characters, which was used as the basis for ISO 8859.

C1 control codes for general use

These are the most common extended control codes, and are defined in ISO/IEC 6429, ECMA-48 and JIS X 0211. If using the ISO/IEC 2022 extension mechanism, they are designated as the active C1 control character set with the sequence 0x1B 0x22 0x43. Although Unicode 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.
Except for , the 8-bit forms of these codes are almost never used., and are used to control text terminals and terminal emulators, but almost always by using their 7-bit escape code representations. Their ISO/IEC 2022 compliant single-byte representations are invalid in UTF-8, and the UTF-8 encodings of their corresponding codepoints are two bytes long like their escape code forms, 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 or Mac OS Roman 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 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.
Esc+DecHexAcroNameDescription
@12880PADPadding CharacterNot part of ISO/IEC 6429. 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 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.
A12981HOPHigh Octet PresetNot part of ISO/IEC 6429. 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 standard code-point name.
B13082BPHBreak Permitted HereFollows 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.
C13183NBHNo Break HereFollows the graphic character that is not to be broken. Not part of the first edition of ISO/IEC 6429. See also word joiner.
D13284INDIndexMove 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.
E13385NELNext LineEquivalent to CR+LF. Used to mark end-of-line on some IBM mainframes.
F13486SSAStart of Selected AreaUsed by block-oriented terminals.
G13587ESAEnd of Selected AreaUsed by block-oriented terminals.
H13688HTSCharacter Tabulation Set
Horizontal Tabulation Set
Causes a character tabulation stop to be set at the active position.
I13789HTJCharacter 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.
J1388AVTSLine Tabulation Set
Vertical Tabulation Set
Causes a line tabulation stop to be set at the active position.
K1398BPLDPartial Line Forward
Partial Line Down
Used to produce subscripts and superscripts in ISO/IEC 6429, e.g., in a printer.
Subscripts use PLD text PLU while superscripts use PLU text PLD.
L1408CPLUPartial Line Backward
Partial Line Up
Used to produce subscripts and superscripts in ISO/IEC 6429, e.g., in a printer.
Subscripts use PLD text PLU while superscripts use PLU text PLD.
M1418DRIReverse Line Feed
Reverse Index
N1428ESS2Next character invokes a graphic character from the G2 or G3 graphic sets respectively. In systems that conform to ISO/IEC 4873, even if a C1 set other than the default is used, these two octets may only be used for this purpose.
O1438FSS3Next character invokes a graphic character from the G2 or G3 graphic sets respectively. In systems that conform to ISO/IEC 4873, even if a C1 set other than the default is used, these two octets may only be used for this purpose.
P14490DCSDevice Control StringFollowed by a string of printable characters and format effectors, terminated by ST. This may be used by variable-length control sequences for text terminals and terminal emulators, such as terminfo queries.
Q14591PU1Private Use 1Reserved 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.
R14692PU2Private Use 2Reserved 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.
S14793STSSet Transmit State
T14894CCHCancel characterDestructive backspace, intended to eliminate ambiguity about meaning of.
U14995MWMessage Waiting
V15096SPAStart of Protected AreaUsed by block-oriented terminals.
W15197EPAEnd of Protected AreaUsed by block-oriented terminals.
X15298SOSStart of StringFollowed by a control string terminated by which, in contrast to those initiated by,, or, may contain any character except SOS or ST. Not part of the first edition of ISO/IEC 6429.
MARC 21 uses SOS and ST in Unicode-format records to mark up a string which should be ignored for collation purposes, while MARC-8 format records use and for the same purpose.
Y15399SGCISingle Graphic Character IntroducerNot 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 mode. In later drafts, this facility was removed, the name was nonetheless retained as a standard code-point name.
Z1549ASCISingle Character IntroducerTo be followed by a single printable character or format effector. 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.
1579DOSCOperating System CommandFollowed by a string of printable characters and format effectors, terminated by ST. These three control codes were intended for use to allow in-band signaling of protocol information, but are rarely used for that purpose.
Some terminal emulators, including xterm, support OSC sequences for setting the window title and reconfiguring the available colour palette. They may also support terminating an OSC sequence with as a non-standard alternative to the standard ST.
^1589EPMPrivacy MessageFollowed by a string of printable characters and format effectors, terminated by ST. These three control codes were intended for use to allow in-band signaling of protocol information, but are rarely used for that purpose.
Some terminal emulators, including xterm, support OSC sequences for setting the window title and reconfiguring the available colour palette. They may also support terminating an OSC sequence with as a non-standard alternative to the standard ST.
_1599FAPCApplication Program CommandFollowed by a string of printable characters and format effectors, terminated by ST. These three control codes were intended for use to allow in-band signaling of protocol information, but are rarely used for that purpose.
Some terminal emulators, including xterm, support OSC sequences for setting the window title and reconfiguring the available colour palette. They may also support terminating an OSC sequence with as a non-standard alternative to the standard ST.

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 and the ISO standard 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 extension mechanism, the DIN version is designated as the active C1 control character set with the sequence 0x1B 0x22 0x45, and the ISO version is designated with the sequence 0x1B 0x22 0x42. The 1985 edition of the ISO version can also be explicitly specified by using the sequence 0x1B 0x26 0x40 0x1B 0x22 0x42.
Esc+DecHexAcroNameDescription
@…F128…13480…86-'
G13587CUSClose-Up for Sorting Declares that two successive character sequences separated by a space or separator should be treated as one word for collation purposes.
H13688NSBNon-Sorting Characters Begin Marks the start of a sequence of characters to be ignored for collation purposes. MARC 21 uses this character in MARC-8 records, but uses 0x98 in Unicode records for the same purpose.
I13789NSENon-Sorting Characters End Marks the end of a sequence of characters to be ignored for collation purposes. MARC 21 uses this character in MARC-8 records, but uses 0x9C in Unicode records for the same purpose.
J1388AFILFiller Character Substitutes for a mandatory alphanumeric character in a field.
K1398BTCITag in Context Indicator Within a bibliographic field, used to refer to data in another bibliographic field by its tag number.
K1398BPLDPartial Line Down Not in the original edition of ISO 6630. In the 1985 edition of ISO 6630, used for Partial Line Down.
L1408CICIIdentification Number in Context Indicator Within a bibliographic field, used to refer to data in another bibliographic record by its ID number.
L1408CPLUPartial Line Up Not in original edition of ISO 6630. In the 1985 edition of ISO 6630, used for Partial Line Up.
M1418DOSCOptional Syllabification Control Marks a syllable boundary in a long word. See also.
M1418DZWJJoiner In MARC-8, used for the Zero-Width Joiner, while U+200D is used in Unicode-format MARC records.
N1428ESS2Single-Shift 2 Non-locking shift code, see above.
N1428EZWNJNon-Joiner In MARC-8, used for the Zero-Width Non-Joiner, while U+200C is used in Unicode-format MARC records.
O1438FSS3Single-Shift 3 Non-locking shift code, see above.
P14490-'
Q14591EABEmbedded Annotation Beginning Marks the start of a variable-length annotation which is embedded within a bibliographic field, as opposed to separated using content designation.
R14692EAEEmbedded Annotation End Marks the end of a variable-length embedded annotation.
S14793ISBItem Specification Beginning Marks the start of a string of specific information of some description, other than a keyword or a permutation string.
T14894ISEItem Specification End Marks the end of a string of specific information.
U14995SIBSorting Interpolation Beginning Marks the beginning of a sequence of characters used for collation purposes only.
V15096SIESorting Interpolation End Marks the end of a sequence of characters used for collation purposes only.
W15197SSBSecondary Sorting Value Beginning Marks the start of a string with subordinate collation value.
X15298SSESecondary Sorting Value End Marks the end of a string with subordinate collation value.
Y15399INCIndicator for Non-Standard Character Identifies a following non-standard character.
Z1549A-
1579DKWEKeyword End Marks the end of a keyword within a bibliographic field.
^1589EPSBPermutation String Beginning Marks the start of a string which is to be permuted to the front of the element. Terminated by PSE or by the end of the element.
_1599FPSEPermutation String End Marks the end of a string which is to be permuted to the front of the element.

Other C1 control code sets

defines 16 additional control codes, besides those present in ASCII. When mapped to Unicode or to ISO 8859, these codes are mapped to C1 control characters in a manner specified by IBM's Character Data Representation Architecture. Although the default mapping of the New Line control does correspond to the ISO/IEC 6429 , the remainder of the control codes do not correspond to ISO/IEC 6429. Even when they have the same behaviour, such as and, the C1-mapped representations of the EBCDIC controls do not correspond to the ISO/IEC 6429 codes. Extended-ASCII-mapped EBCDIC can therefore be regarded as having its own C1 set, although it is not registered with the ISO-IR registry for use with ISO/IEC 2022.
Various specialised C1 control code sets are registered for use by various Videotex formats.

Unicode

Unicode sets aside 65 code points in the general category "Cc" for compatibility with ISO/IEC 2022. The Unicode control characters cover U+0000—U+001F, U+007F, and U+0080—U+009F. 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.
Unicode has no category "Cc" code points allocated other than the C0 and C1 ones. However, it does include additional format effector characters besides those in the C0 and C1 control sets, such as marks, embeds, isolates and pops for explicit bidirectional formatting, and the zero-width joiner and non-joiner for controlling ligature use. These are given the general category "Cf" rather than "Cc".

Footnotes