All Topics  
Escape sequence

 

   Email Print
   Bookmark   Link






 

Escape sequence



 
 
An escape sequence is a series of characters
Character (computing)

In computer and machine-based telecommunications terminology, a character is a unit of information that roughly corresponds to a grapheme, grapheme-like unit, or symbol, such as in an alphabet or syllabary in the written language form of a natural language....
 used to change the state of computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
s and their attached peripheral
Peripheral

A peripheral is a device attached to a host computer behind the chipset whose primary functionality is dependent upon the host, and can therefore be considered as expanding the hosts capabilities, while not forming part of the system's core computer architecture....
 devices. These are also known as control sequences, reflecting their use in device control. Some control sequences are special characters which always have the same meaning. Escape sequences use an escape character
Escape character

In computing and telecommunication, an escape character is a single character which in a sequence of characters signifies that what is to follow takes an alternative interpretation....
 to change the meaning of the characters which follow it. The characters can be interpreted as a command to be executed rather than data.

Escape sequences are commonly used when the computer and the peripheral have only a single channel in which to send information back and forth.






Discussion
Ask a question about 'Escape sequence'
Start a new discussion about 'Escape sequence'
Answer questions from other users
Full Discussion Forum



Encyclopedia


An escape sequence is a series of characters
Character (computing)

In computer and machine-based telecommunications terminology, a character is a unit of information that roughly corresponds to a grapheme, grapheme-like unit, or symbol, such as in an alphabet or syllabary in the written language form of a natural language....
 used to change the state of computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
s and their attached peripheral
Peripheral

A peripheral is a device attached to a host computer behind the chipset whose primary functionality is dependent upon the host, and can therefore be considered as expanding the hosts capabilities, while not forming part of the system's core computer architecture....
 devices. These are also known as control sequences, reflecting their use in device control. Some control sequences are special characters which always have the same meaning. Escape sequences use an escape character
Escape character

In computing and telecommunication, an escape character is a single character which in a sequence of characters signifies that what is to follow takes an alternative interpretation....
 to change the meaning of the characters which follow it. The characters can be interpreted as a command to be executed rather than data.

Escape sequences are commonly used when the computer and the peripheral have only a single channel in which to send information back and forth. If the device in question is "dumb" and can only do one thing with the information being sent to it (for instance, print it) then there is no need for an escape sequence. However most devices have more than one capability, and thus need some way to distinguish information that is to be treated as data from information that is to be treated as commands.

An escape character
Escape character

In computing and telecommunication, an escape character is a single character which in a sequence of characters signifies that what is to follow takes an alternative interpretation....
 is usually assigned to the Esc key
Esc key

The Esc key is a key labeled Esc or Escape that is used to generate the ASCII Escape character , the character code traditionally used to initiate an escape sequence....
 on a computer keyboard, and can be sent in other ways than as part of an escape sequence. For example, the Esc key may be used as an input character in editors such as EMACS
Emacs

Emacs is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has, perhaps, more editing commands than any other editor or word processor, numbering over 1,000....
, or for backing up one level in a menu in some applications. The Hewlett Packard HP 2640
HP 2640

The HP 2640A and other HP 264X models were block-mode "smart" and intelligent ASCII standard serial Computer terminal produced by Hewlett Packard using the Intel 8008 and Intel 8080 microprocessors....
 terminals had a key for a "display functions" mode which would display graphics for all control characters, including Esc, to aid in debugging applications.

If the Esc key and other keys that send escape sequences are both supposed to be meaningful to an application, an ambiguity
Ambiguity

Ambiguity is the property of being ambiguous, where a word, term, notation, sign, symbol, phrase, Sentence , or any other form used for communication, is called ambiguous if it can be interpreted in more than one way....
 arises, if a terminal
Computer terminal

A computer terminal is an electronic or electromechanical computer hardware device that is used for entering data into, and displaying data from, a computer or a computing system....
 or terminal emulator
Terminal emulator

A terminal emulator, terminal application, term, or tty for short, is a program that emulates a "dumb" video Computer terminal within some other display architecture....
 is in use. In particular, when the application receives the ASCII escape character, it is not clear whether that character is the result of the user pressing the Esc key or whether it is the initial character of an escape sequence (e.g., resulting from an arrow key press). The traditional method of resolving the ambiguity is to observe whether or not another character quickly follows the escape character. If not, it is assumed not to be part of an escape sequence. Obviously this heuristic
Heuristic

Heuristic is an adjective for methods that help in problem solving, in turn leading to learning and discovery. These methods in most cases employ experimentation and trial-and-error techniques....
 can fail under some circumstances, but in practice it works reasonably well, especially with faster modern communication speeds.

Escape sequences date back at least to the 1874 Baudot code
Baudot code

The Baudot code, invented by ?mile Baudot, is a character encoding predating EBCDIC and ASCII, and the root predecessor to International Telegraph Alphabet No 2 , the teleprinter code in use until the advent of ASCII....
.

Modem control

The Hayes command set
Hayes command set

The Hayes command set is a specific command language originally developed for the Hayes Microcomputer Products Smartmodem 300 baud modem. The command set consists of a series of short text strings which combine together to produce complete commands for operations such as dialing, hanging up, and changing the parameters of the connection....
, for instance, defines a single escape sequence, +++. (In order not to interpret +++ which may be a part of data as the escape sequence the sender stops communication for one second before and after the +++) .When the modem encounters this in a stream of data, it switches from its normal mode of operation which simply sends any characters to the phone, to a command mode in which the following data is assumed to be a part of the command language. You can switch back to the online mode by sending the O command.

The Hayes command set is modal
Mode (computer interface)

In user interface design, a mode is a distinct setting within a computer program or any physical machine interface, in which the same user input will produce perceived different results than it would in other settings....
, switching from command mode to online mode. This is not appropriate in the case where the commands and data will switch back and forth rapidly. An example of a non-modal escape sequence control language is the VT100
VT100

VT100 is a video computer terminal which was made by Digital Equipment Corporation . It became the de facto standard used by terminal emulators....
, which used a series of commands prefixed by the Control Sequence Introducer, escape-.

Comparison with control characters

A control character
Control character

In computing and telecommunication, a control Grapheme or non-printing character is a code point in a character encoding, that does not in itself represent a written symbol....
 is a character that, in isolation, has some control function, such as carriage return
Carriage return

Originally, carriage return was the term for the control character in Baudot code on a Teleprinter for end of line return to beginning of line and did not include line feed....
 (CR). Escape sequences, by contrast, consist of an escape character
Escape character

In computing and telecommunication, an escape character is a single character which in a sequence of characters signifies that what is to follow takes an alternative interpretation....
 or sequence which changes the interpretation of following characters.

The earlier VT52
VT52

The VT52 was a cathode ray tube-based computer terminal produced by Digital Equipment Corporation during the late 1970s. It provided a screen of 24 rows and 80 columns of text and supported all 95 ASCII characters as well as 32 graphics characters....
 terminal used simple digraph
Digraph

Digraph may refer to:* Digraph , a pair of characters used to write one phoneme or a sequence of phonemes that does not correspond to the normal values of the two characters combined...
 commands like escape-A: in isolation, "A" simply meant the letter "A", but as part of the escape sequence "escape-A", it had a different meaning. The VT52 also supported parameters: it was not a straightforward control language encoded as substitution.

ASCII Video Data Terminals

The VT100
VT100

VT100 is a video computer terminal which was made by Digital Equipment Corporation . It became the de facto standard used by terminal emulators....
 terminal implemented the more sophisticated ANSI standard (now ECMA-48) for functions such as controlling cursor movement, character set, and display enhancements. The Hewlett Packard HP 2640
HP 2640

The HP 2640A and other HP 264X models were block-mode "smart" and intelligent ASCII standard serial Computer terminal produced by Hewlett Packard using the Intel 8008 and Intel 8080 microprocessors....
 series had perhaps the most elaborate escape sequences for block and character modes, programming keys and their soft labels, graphics vectors, and even saving data to tape or disk files.

Use in DOS and Windows

A utility, ANSI.SYS
ANSI.SYS

ANSI.SYS is a device driver in the DOS operating system that provides extra computer console functions through ANSI escape codes. It is partially based upon a subset of the text terminal control standard proposed by the American National Standards Institute X3L2 Technical Committee on Codes and Character Sets ....
, can be used to enable the interpreting of the ANSI (ECMA-48) terminal escape sequences in a DOS command window in DOS or 16-bit Windows. The rise of GUI
Gui

Gui or guee is a generic term to refer to grillinged dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients....
 applications, which directly write to display cards, has greatly reduced the usage of escape sequences on Microsoft platforms, but they can still be used to create interactive random-access character based screen interfaces with the character based library routines such as printf
Printf

The class of printf functions is a class of function , typically associated with curly bracket programming languages, that accept a string parameter which specifies a method for rendering a number of other parameters into a string....
 without resorting to a GUI program.

See also

  • Control character
    Control character

    In computing and telecommunication, a control Grapheme or non-printing character is a code point in a character encoding, that does not in itself represent a written symbol....
  • Escape character
    Escape character

    In computing and telecommunication, an escape character is a single character which in a sequence of characters signifies that what is to follow takes an alternative interpretation....