This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Caret notation" – news ·newspapers ·books ·scholar ·JSTOR(July 2013) (Learn how and when to remove this message) |
Caret notation is a notation forcontrol characters inASCII. The notation assigns^A to control-code 1, sequentially through the alphabet to^Z assigned to control-code 26. For the control-codes outside of the range 1–26, the notation extends to the adjacent, non-alphabetic ASCII characters; for example^@ is used forcontrol-code 0.
Often a control character can be typed on a keyboard by holding down theCtrl 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 tocut the text").
The meaning or interpretation of, or response to the individual control-codes isnot prescribed by the letters in caret notation.
The notation consists of acaret (^) 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^A through^Z. Seven ASCII control characters map outside the upper-case alphabet: 0 (NUL) is^@, 27 (ESC) is^[, 28 (FS) is^\, 29 (GS) is^], 30 (RS) is^^, 31 (US) is^_, and 127 (DEL) is^?.
Examples are "^M^J" for the Windows CR, LFnewline pair, and describing theANSI escape sequence to clear the screen as "^[[3J".
Only the use of characters in the range of 63–95 ("?@ABC...XYZ[\]^_") 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. When convertingto 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 theC1 control characters from 128–159 (0x80–0x9F). Some programs that produce caret notation show these as backslash andoctal ("\200" through "\237"). Also seethe bar notation used by Acorn Computers, below.
The convention dates back to at least thePDP-6 (1964). A manual for the PDP-6 describesControl+C as printing↑C, i.e., a small superscript upwards arrow before the C.[1] In the change from 1961 ASCII to 1968 ASCII, the up arrow became a caret.[2]
Caret notation is used to describe control characters in output by many programs, especially onUnix. They can be seen when echoing characters as the user types them as input, and showing the contents of files in a text editor or with themore andless commands.
Many terminals and terminal emulators allow the user to enter a control character by holding downCtrl and typing the caret notation letter. Many control characters (e.g.,EOT) otherwise cannot be entered directly from a keyboard. Usually, the need to hold down⇧ Shift is avoided, for instance lower-case letters work just like upper-case ones. On a US keyboard layoutctrl+/ produces DEL andctrl+2 produces ^@. It is also common forctrl+space to produce ^@.
This correspondence has affected shortcuts used even in modern software. For instance it might be tempting to makeCtrl+H mean "Help" but this is the same code as← Backspace so other shortcuts for Help were devised.
The GSTrans string processing API on the operating systems for theAcorn Atom and theBBC Micro, and onRISC OS for theAcorn Archimedes and later machines, use the vertical bar character| in place of the caret. For example,|M (pronounced "control em", the same as for the^M notation) is thecarriage return character,ASCII 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 code128 + 127 = 255.
There was the change from 1961 ASCII to 1968 ASCII. Some computer languages used characters in 1961 ASCII such as up arrow and left arrow. These characters disappeared from 1968 ASCII. We worked with Fred Mocking, who by now was in Sales atTeletype, on a type cylinder that would compromise the changing characters so that the meanings of 1961 ASCII were not totally lost. The underscore character was made rather wedge-shaped so it could also serve as a left arrow.
Thischaracter encoding article is astub. You can help Wikipedia byexpanding it. |