C0 and C1 control codes
From Wikipedia, the free encyclopedia
The C0 and C1 control code sets define control codes for use in text. C0, originally defined in ISO 646, defines codes in the range 00HEX–1FHEX. C1, originally defined in ISO 6429, defines codes in the range 80HEX–9FHEX. The C0 codes are contained in ASCII and most encodings based on it. The C1 codes were included in the ISO-8859-n series of encodings and Unicode but 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 actually refer to the characters at that position in a proprietary, system-specific encoding such as Windows-1252 or the Apple Macintosh ("MacRoman") character set, though this is technically invalid under the ISO encodings. Such characters are more commonly accessed using the equivalent two octet escape sequence.
Most applications only interpret the C0 control codes for LF, CR, and HT. A few applications also interpret C0 codes VT and FF, and the C1 code NEL. Very few applications interpret the other C0 and C1 control codes.
Contents |
[edit] C0 (ASCII and derivatives)
| Seq | Dec | Hex | Abbr | Character name | Description/notes |
|---|---|---|---|---|---|
| ^@ | 00 | 0x00 | NUL | Null | 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 C programming language. |
| ^A | 01 | 0x01 | SOH | Start of Heading | First character of a message heading. In some computer terminals, moves cursor to the first column. |
| ^B | 02 | 0x02 | STX | Start of Text | First character of message text, and may be used to terminate the message heading. |
| ^C | 03 | 0x03 | ETX | End of Text | Often used as a "break" character (Ctrl-C) to interrupt or terminate a program or process. In TOPS-20, it was used to gain the system's attention before logging in. |
| ^D | 04 | 0x04 | EOT | End of Transmission | Used on Unix to signal end-of-file condition on, or to logout from, a terminal. On Apple II systems, it signaled that a DOS command followed. |
| ^E | 05 | 0x05 | ENQ | Enquiry | Signal intended to trigger a response at the receiving end, to see if it is still present. In some computer terminal and EMACS , moves the cursor to the end of current line. |
| ^F | 06 | 0x06 | ACK | Acknowledge | response to an ENQ, or an indication of successful receipt of a message. |
| ^G | 07 | 0x07 | BEL | Bell | 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). |
| ^H | 08 | 0x08 | BS | Backspace | Move the cursor one position leftwards. On input, this may delete the character to the left of the cursor. |
| ^I | 09 | 0x09 | HT | Horizontal Tab | Position to the next horizontal tab stop. |
| ^J | 10 | 0x0A | LF | Line Feed | 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 MS-DOS, Windows, and various network standards, used following CR as part of the end-of-line mark. |
| ^K | 11 | 0x0B | VT | Vertical Tab | Position the form at the next vertical tab stop. |
| ^L | 12 | 0x0C | FF | Form Feed | 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. |
| ^M | 13 | 0x0D | CR | Carriage Return | Originally used to move the cursor to column zero while staying on the same line. On 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 MS-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. |
| ^N | 14 | 0x0E | SO | Shift Out | Switch to an alternate character set. |
| ^O | 15 | 0x0F | SI | Shift In | Return to regular character set after Shift Out. In TOPS-20, it signalled that further output should be discarded; the program would continue to run but not display or print anything until ^O is typed again. |
| ^P | 16 | 0x10 | DLE | Data Link Escape | Cause the following data to be interpreted as raw data, not control codes. |
| ^Q | 17 | 0x11 | DC1 | Device Control 1/XON | Resume transmission. Used for software flow control. In some terminal programs, ends pause started with Ctrl-S. |
| ^R | 18 | 0x12 | DC2 | Device Control 2 | In TOPS-20, reprinted the current line, tidying up any character deletions. |
| ^S | 19 | 0x13 | DC3 | Device Control 3/XOFF | Suspend transmission. Used for software flow control. In some terminal programs, pauses display of text. |
| ^T | 20 | 0x14 | DC4 | Device Control 4 | In TOPS-20, it caused a brief system-status line to be displayed. |
| ^U | 21 | 0x15 | 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. In some text editors, it was used as a "Delete Line" character. |
| ^V | 22 | 0x16 | 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. In some terminal programs, allows literal entry of control codes without them being interpreted. |
| ^W | 23 | 0x17 | ETB | End of Transmission Block | Indicates the end of a transmission block of data when data are divided into such blocks for transmission purposes. In some text editors, it is used as a "Delete Word" character which rubs out the previous text entry back to the preceding space. |
| ^X | 24 | 0x18 | CAN | Cancel | Indicates that the data with which it is associated are in error or are to be disregarded, or cannot be represented on a particular device. |
| ^Y | 25 | 0x19 | EM | End of Medium | In many programs, a keyboard input of Ctrl-Y is a "redo" command to undo the last Ctrl-Z undo command. |
| ^Z | 26 | 0x1A | SUB | Substitute | On MS-DOS systems with files opened in text mode, "end of text" or "end of file" is marked by the Ctrl-Z character (code 26, "Substitute"), instead of ^C or ^D common on other operating systems. In many programs, a keyboard input of Ctrl-Z is an "undo" command to reverse the most recent input or action. In many terminal programs, this will suspend the active process and return control to the shell. |
| ^[ | 27 | 0x1B | ESC | Escape | 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. |
| ^\ | 28 | 0x1C | 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. These can usually be generated by holding down Ctrl and the backslash, right square bracket, caret, and underscore keys respectively. |
| ^] | 29 | 0x1D | GS | Group Separator | |
| ^^ | 30 | 0x1E | RS | Record Separator | |
| ^_ | 31 | 0x1F | US | Unit Separator | |
| ^? | 127 | 0x7F | DEL | Rubout/Delete | 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. |
[edit] C1 (ISO 8859 and Unicode)
| Dec | Hex | Esc Seq | Short Abbr (RFC 1345) | Full Abbr | Character name | Description/notes |
|---|---|---|---|---|---|---|
| 128 | 0x80 | 0x1B 0x40 | PA | PAD | Padding Character | listed as XXX in unicode |
| 129 | 0x81 | 0x1B 0x41 | HO | HOP | High Octet Preset | |
| 130 | 0x82 | 0x1B 0x42 | BH | BPH | Break Permitted Here | |
| 131 | 0x83 | 0x1B 0x43 | NH | NBH | No Break Here | |
| 132 | 0x84 | 0x1B 0x44 | IN | IND | Index | Deprecated in 1986 and withdrawn in 1991 from ISO/IEC 6429 (ECMA-48) |
| 133 | 0x85 | 0x1B 0x45 | NL | NEL | Next Line | Used to mark end-of-line on some IBM mainframes. |
| 134 | 0x86 | 0x1B 0x46 | SA | SSA | Start of Selected Area | |
| 135 | 0x87 | 0x1B 0x47 | ES | ESA | End of Selected Area | |
| 136 | 0x88 | 0x1B 0x48 | HS | HTS | Horizontal Tab Set | |
| 137 | 0x89 | 0x1B 0x49 | HJ | HTJ | Horizontal Tab Justified | |
| 138 | 0x8A | 0x1B 0x4A | VS | VTS | Vertical Tab Set | |
| 139 | 0x8B | 0x1B 0x4B | PD | PLD | Partial Line Forward | 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..
|
| 140 | 0x8C | 0x1B 0x4C | PU | PLU | Partial Line Backward | |
| 141 | 0x8D | 0x1B 0x4D | RI | RI | Reverse Line Feed | |
| 142 | 0x8E | 0x1B 0x4E | S2 | SS2 | Single-Shift 2 | |
| 143 | 0x8F | 0x1B 0x4F | S3 | SS3 | Single-Shift 3 | |
| 144 | 0x90 | 0x1B 0x50 | DC | DCS | Device Control String | |
| 145 | 0x91 | 0x1B 0x51 | P1 | PU1 | Private Use 1 | |
| 146 | 0x92 | 0x1B 0x52 | P2 | PU2 | Private Use 2 | |
| 147 | 0x93 | 0x1B 0x53 | TS | STS | Set Transmit State | |
| 148 | 0x94 | 0x1B 0x54 | CC | CCH | Cancel character | |
| 149 | 0x95 | 0x1B 0x55 | MW | MW | Message Waiting | |
| 150 | 0x96 | 0x1B 0x56 | SG | SPA | Start of Protected Area | |
| 151 | 0x97 | 0x1B 0x57 | EG | EPA | End of Protected Area | |
| 152 | 0x98 | 0x1B 0x58 | SS | SOS | Start of String | |
| 153 | 0x99 | 0x1B 0x59 | GC | SGCI | Single Graphic Char Intro | listed as XXX in unicode |
| 154 | 0x9A | 0x1B 0x5A | SC | SCI | Single Char Intro | |
| 155 | 0x9B | 0x1B 0x5B | CI | CSI | Control Sequence Introducer | |
| 156 | 0x9C | 0x1B 0x5C | SI | ST | String Terminator | |
| 157 | 0x9D | 0x1B 0x5D | OC | OSC | OS Command | |
| 158 | 0x9E | 0x1B 0x5E | PM | PM | Private Message | |
| 159 | 0x9F | 0x1B 0x5F | AC | APC | App Program Command |
[edit] References
- http://www.unicode.org/charts/PDF/U0000.pdf
- http://www.unicode.org/charts/PDF/U0080.pdf
- ATIS Telecom Glossary 2000
- 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 sequencespt:SOH

