HOME

TheInfoList



OR:

Caret notation is a notation for
control character In computing and telecommunication, a control character or non-printing character (NPC) is a code point (a number) in a character set, that does not represent a written symbol. They are used as in-band signaling to cause effects other than the ...
s 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 ...
. The notation assigns to control-code 1, sequentially through the alphabet to assigned to control-code 26 (0x1A). For the control-codes outside of the range 1–26, the notation extends to the adjacent, non-alphabetic ASCII characters. Often a control character can be typed on a keyboard by holding down the and typing the character shown after the caret. The notation is often used to describe keyboard shortcuts even though the control character is not actually used (as in "type ^X to cut the text"). The meaning or interpretation of, or response to the individual control-codes is ''not'' prescribed by the caret notation.


Description

The notation consists of a ''
caret Caret is the name used familiarly for the character , provided on most QWERTY keyboards by typing . The symbol has a variety of uses in programming and mathematics. The name "caret" arose from its visual similarity to the original proofreade ...
'' () followed by a single character (usually a capital letter). The character has the ASCII code equal to the control code with the bit representing 0x40 reversed. A useful mnemonic, this has the effect of rendering the control codes 1 through 26 as through . Seven ASCII control characters map outside the upper-case alphabet: 0 ( NUL) is , 27 ( ESC) is , 28 is , 29 is , 30 is , 31 is , and 127 ( DEL) is . Examples are "" for the Windows CR, LF
newline Newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. This character, or a ...
pair, and describing the ANSI escape sequence to clear the screen as "". Only the use of characters in the range of 63–95 ("") is specifically allowed in the notation, but use of lower-case alphabetic characters entered at the keyboard is nearly always allowed – they are treated as equivalent to upper-case letters. The conversion is a bit-wise
exclusive or Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false). It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, , ...
with 0x40 (64). This is identical to adding 64 modulus 128, or adding 64 and masking with 0x7F. This same operation is done both to convert from a control code to the character to print after the caret, and the reverse to convert a character to a control code. When converting ''to'' a control character, except for '?', masking with 0x1F will produce the same result and also turn lower-case into the same control character as upper-case. There is no corresponding version of the caret notation for control-codes with more than 7 bits such as the C1 control characters from 128–159 (0x80–0x9F). Some programs that produce caret notation show these as backslash and
octal The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
("" through ""). ''Also see the bar notation used by Acorn Computers, below''.


History

The convention dates back to at least the
PDP-6 The PDP-6, short for Programmed Data Processor model 6, is a computer developed by Digital Equipment Corporation (DEC) during 1963 and first delivered in the summer of 1964. It was an expansion of DEC's existing 18-bit systems to use a 36-bit ...
(1964). A manual for the PDP-6 describes as printing C, i.e. a small superscript upwards arrow before the C. In the change from 1961 ASCII to 1968 ASCII, the up arrow became a caret.


Use in software

Many computer systems allow the user to enter a control character by holding down and pressing the letter used in the caret notation. This is practical, because many control characters (e.g. EOT) cannot be entered directly from a keyboard. Although there are many ways to represent control characters, this correspondence between notation and typing makes the caret notation suitable for many applications. Usually the need to hold down is avoided, for instance lower-case letters work just like upper-case ones. On a US keyboard layout produces DEL and produces ^@. It is also common for to produce ^@. Caret notation is used to describe control characters in output by many programs, particularly
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
terminal drivers and text file viewers such as and commands. Although the use of control-codes is somewhat standard, some uses differ from operating system to operating system, or even from program to program. The actual meaning or interpretation of the individual control-codes is ''not'' prescribed by the caret notation, and although the ASCII specification does give names to the control-codes, it does not prescribe how software should respond to them.


Alternate notations

The GSTrans string processing API on the operating systems for the Acorn Atom and the
BBC Micro The British Broadcasting Corporation Microcomputer System, or BBC Micro, is a series of microcomputers and associated peripherals designed and built by Acorn Computers in the 1980s for the BBC Computer Literacy Project. Designed with an empha ...
, and on
RISC OS RISC OS is a computer operating system originally designed by Acorn Computers Ltd in Cambridge, England. First released in 1987, it was designed to run on the ARM chipset, which Acorn had designed concurrently for use in its new line of Archi ...
for the
Acorn Archimedes Acorn Archimedes is a family of personal computers designed by Acorn Computers of Cambridge, England. The systems are based on Acorn's own ARM architecture processors and the proprietary operating systems Arthur and RISC OS. The first models ...
and later machines, use the vertical bar character in place of the caret. For example, (pronounced "control em", the same as for the notation) is the
carriage return A carriage return, sometimes known as a cartridge return and often shortened to CR, or return, is a control character or mechanism used to reset a device's position to the beginning of a line of text. It is closely associated with the line feed ...
character,
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 ...
13. is the vertical bar character code 124, is character 127 as above and adds 128 to the code of the character that follows it, so is character code .


See also

* ASCII control characters *
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 curso ...
, which shows the caret notation for all C0 control codes as well as DEL *
Control key In computing, a Control key is a modifier key which, when pressed in conjunction with another key, performs a special operation (for example, ); similar to the Shift key, the Control key rarely performs any function when pressed by itself. ...


References

Control characters Character sets {{CharacterEncoding-stub