Escape sequence

[2] When directed, this series of characters is used to change the state of computers and their attached peripheral devices, rather than to be displayed or printed as regular data bytes would be, these are also known as control sequences, reflecting their use in device control, beginning with the Control Sequence Initiator - originally the "escape character" ASCII code - character 27 (decimal) - often written "Esc" on keycaps.

Even relatively "dumb" terminals responded to some escape sequences, including the original mechanical Teletype printers (on which "glass Teletypes" or VDUs were based) responded to characters 27 and 31 to alternate between letters and figures modes.

For example, the Esc key may be used as an input character in editors such as vi,[13] or for backing up one level in a menu in some applications.

(In order 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.

The later VT100 terminal implemented the more sophisticated ANSI escape sequences standard (now ECMA-48) for functions such as controlling cursor movement, character set, and display enhancements.

The Hewlett Packard HP 2640 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.

The rise of GUI 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 without resorting to a GUI program.

When an escape character is needed within the quoted/escaped string, there are two strategies used within programming and scripting languages: An example of the latter is in the use of the caret (^).

Many modern programming languages specify the doublequote character (") as a delimiter for a string literal.