480:
A common use of escape sequences is in fact to remove control characters found in a binary data stream so that they will not cause their control function by mistake. In this case, the control character is replaced by a defined "escape character" (which need not be the US-ASCII escape character) and
217:
with 7 data bits for communication, and sometimes would be used to switch to a different character set for "foreign" or graphics characters that would otherwise been restricted by the 128 codes available in 7 data bits. Even relatively "dumb" terminals responded to some escape sequences, including
257:
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
500:
themselves might not be allowed to be placed in the program coded by the editor program, or may have undesirable side-effects if typed into a command. The end-of-quote character is also a problem for programmers that can be solved by escaping it. In most contexts the escape character is the
400:
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
295:.) 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
352:
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.
200:
terminal control sequences, but they often were still called escape sequences, and the very common use of "escaping" special characters in programming languages and command-line parameters today often use the "backslash" character to begin the
481:
one or more other characters; after exiting the context where the control character would have caused an action, the sequence is recognized and replaced by the removed character. To transmit the "escape character" itself, two copies are sent.
306:, 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
536:
for a string literal. The backslash escape character typically provides ways to include doublequotes inside a string literal, such as by modifying the meaning of the doublequote character embedded in the string
205:
Escape sequences in communications are commonly used when a computer and a peripheral have only a single channel through which to send information back and forth (so escape sequences are an example of
78:
constitute an escape sequence, but splices physical source lines into logical ones in the second translation phase, whereas string escape sequences are converted in the fifth translation phase.
368:
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.
218:
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.
125:
sequences, the combination of three or more characters beginning with the ASCII "escape" character (decimal character code 27) followed by the left-bracket character
27:
This article is about sequences of characters that, because of a prefix, have a special meaning, possibly to control peripheral devices. For specialized usages, see
864:
51:
that has a meaning other than the literal characters contained therein; it is marked by one or more preceding (and possibly terminating) characters.
234:, 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
684:
Some programming languages also provide other ways to represent special characters in literals, without requiring an escape character (see e.g.
626:
uses "\x" to indicate the following two characters are hexadecimal digits, "22" being the ASCII value for a doublequote in hexadecimal.
249:
If the Esc key and other keys that send escape sequences are both supposed to be meaningful to an application, an ambiguity arises if a
364:
standard (now ECMA-48) for functions such as controlling cursor movement, character set, and display enhancements. The
Hewlett Packard
242:
terminals had a key for a "display functions" mode which would display graphics for all control characters, including Esc, to aid in
813:
28:
557:
291:, which may be a part of data, as the escape sequence, the sender stops communication for one second before and after the
850:
801:) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines.
85:
can be used, whereby the first backslash indicates an escape and the second specifies that a backslash is being escaped.
541:), or by modifying the meaning of a sequence of characters including the hexadecimal value of a doublequote character (
1118:
641:
637:
434:
is needed within the quoted/escaped string, there are two strategies used within programming and scripting languages:
311:
1030:+++ - "Escape Sequence" - This command initiates an escape sequence to return the modem to the on-line command mode
1059:
906:
258:
character quickly follows the escape character. If not, it is assumed not to be part of an escape sequence. This
1013:
elements C0 and C1 of control characters a 5-bit code patented by Jean-Maurice-Emile Baudot (1845-1903) in 1874
496:, to express characters which are not printable or clash with the syntax of characters or strings. For example,
629:
143:
61:
971:
64:
and many derivative programming languages, a string escape sequence is a series of two or more characters,
1098:
1078:
833:
475:
361:
303:
139:
65:
48:
1042:
712:
707:
485:
389:
88:
A character may be escaped in multiple different ways. Assuming ASCII encoding, the escape sequences
789:
746:
685:
349:
1008:
892:
678:
497:
250:
166:- originally the "escape character" ASCII code - character 27 (decimal) - often written "Esc" on
380:, can be used to enable the interpreting of the ANSI (ECMA-48) terminal escape sequences under
697:
489:
323:
278:
231:
206:
189:
702:
671:
653:
649:
431:
333:
235:
155:
122:
40:
329:
328:
A control character is a character that, in isolation, has some control function, such as
764:
283:
262:
can fail under some circumstances, especially without fast modern communication speeds.
493:
469:
210:
951:
1112:
976:
934:
197:
238:, or for backing up one level in a menu in some applications. The Hewlett Packard
732:
1025:
657:
266:
93:
17:
991:
878:
645:
151:
173:
With the introduction of ANSI terminals most escape sequences began with the
920:
533:
502:
259:
243:
674:
to quote characters with a special meaning, as for non-ASCII characters.
377:
147:
797:
5.1.1.2 Translation phases, 2.: Each instance of a backslash character (
1047:
When a modem is in command mode, the modem can accept commands from you
996:
The Baudot code, invented in 1870 and patented in 1874 by J. Baudot is
956:
517:
For example, the single quotation mark character might be expressed as
454:
393:
365:
239:
227:
528:
Many modern programming languages specify the doublequote character (
402:
167:
633:
414:
357:
307:
254:
214:
105:
74:
Note that in C a backslash immediately followed by a newline does
184:
Not all control sequences used an escape character; for example:
553:
345:
677:
Another similar (and partially overlapping) syntactic trick is
596:"Nancy said \"Hello World!\" to the crowd."
1061:
17. Understanding ANSI.SYS - Special
Edition Using MS-DOS 6.22
851:"AT Command Set and Register Summary for Analog Modem Modules"
818:
773:
followed by a letter or by a combination of digits are called
667:
663:
397:
381:
162:, reflecting their use in device control, beginning with the
1079:"Apostrophe Editing ('aaa') (FORTRAN 77 Language Reference)"
644:
all allow exactly the same two backslash escape styles. The
332:(CR). Escape sequences, by contrast, consist of one or more
413:
The default text terminal, and text windows (such as using
154:
devices, rather than to be displayed or printed as regular
453:). E.g. this outputs "You can do so via Cut&Paste" in
336:
which change the interpretation of subsequent characters.
615:"Nancy said \x22Hello World!\x22 to the crowd."
488:
and command line interfaces escape sequences are used in
129:(decimal character code 91) defines an escape sequence.
939:
vi commands
Pressing the Esc (Escape) key is how you
893:"Data General DG210 DG211 Terminal Emulation Software"
449:
An example of the latter is in the use of the caret (
607:produces the intended output. Another alternative:
177:characters "ESC" then "[" or a specially-allocated
457:. (otherwise, the ampersand has a restricted use)
281:, for instance, defines a single escape sequence,
769:Character combinations consisting of a backslash
545:). Both sequences encode a literal doublequote (
310:, which used a series of commands prefixed by a
265:Escape sequences date back at least to the 1874
226:An escape character is usually assigned to the
1083:Within the field, two consecutive apostrophes
1009:"Guide to the use of Character Sets in Europe"
253:is in use. When the application receives the
112:all encode the same character: the backslash
81:To represent the backslash character itself,
8:
921:"Terminals & Printers Handbook Glossary"
360:terminal implemented the more sophisticated
34:Character combinations with ulterior meaning
790:"ISO/IEC 9899:201x Committee Draft N1570"
392:command) or in command windows in 16-bit
1093:
1091:
158:bytes would be, these are also known as
972:"What is ASCII? The Economist explains"
865:"Data General terminals: discussion of"
724:
1073:
1071:
952:"Five Unexpected Uses for the Esc Key"
470:String literal ยง Escape sequences
460:echo You can do so via Cut^&Paste
181:character with a code 155 (decimal).
7:
417:) respond to ANSI escape sequences.
405:without resorting to a GUI program.
1099:"CMD - Batch - Escaping with Caret"
188:modem control sequences used by AT/
588:produces a syntax error, whereas:
318:Comparison with control characters
25:
652:also use backslash escapes. The
29:Escape sequence (disambiguation)
409:Use in Linux and Unix displays
209:). They were common when most
138:When directed, this series of
1:
935:"Twelve Useful "vi" Commands"
1026:"Basic Hayes AT Command Set"
121:For devices that respond to
312:Control Sequence Introducer
1135:
1043:"Modem Programming Basics"
580:" to the crowd."
473:
467:
340:ASCII video data terminals
321:
299:by sending the O command.
164:Control Sequence Initiator
66:starting with a backslash
26:
834:"Chapter 5 โ AT Commands"
445:secondary escape sequence
302:The Hayes command set is
287:. (In order to interpret
660:as an escape character.
609:
590:
562:
438:doubled delimiter (e.g.
992:"Baudot and CCITT code"
648:language and Microsoft
568:"Nancy said "
602:### example of \"
372:Use in DOS and Windows
142:is used to change the
713:format control string
486:programming languages
476:Escape sequences in C
468:Further information:
362:ANSI escape sequences
348:terminal used simple
879:"What's a Terminal?"
708:printf format string
47:is a combination of
686:delimiter collision
621:### example of \x22
525:is not acceptable.
440:'He didn''t do it.'
150:and their attached
1119:Control characters
814:"Escape sequences"
765:"Escape Sequences"
751:The Java Tutorials
656:encoding uses the
498:control characters
490:character literals
251:character terminal
907:"Escape sequence"
733:"Escape Sequence"
698:Control character
334:escape characters
324:Control character
279:Hayes command set
232:computer keyboard
207:in-band signaling
160:control sequences
134:Control sequences
16:(Redirected from
1126:
1103:
1102:
1095:
1086:
1085:
1075:
1066:
1065:
1056:
1050:
1049:
1039:
1033:
1032:
1022:
1016:
1015:
1005:
999:
998:
988:
982:
981:
968:
962:
961:
948:
942:
941:
931:
925:
924:
917:
911:
910:
903:
897:
896:
889:
883:
882:
875:
869:
868:
861:
855:
854:
847:
841:
840:
838:
830:
824:
823:
810:
804:
803:
800:
794:
786:
780:
779:
775:escape sequences
772:
761:
755:
754:
743:
737:
736:
729:
703:Escape character
672:percent-encoding
654:quoted-printable
650:Rich Text Format
622:
619:
616:
613:
603:
600:
597:
594:
584:
581:
578:
575:
572:
569:
566:
548:
544:
540:
531:
524:
520:
452:
441:
432:escape character
387:
190:Hayes-compatible
128:
115:
111:
103:
99:
91:
84:
69:
41:computer science
21:
18:Escape sequences
1134:
1133:
1129:
1128:
1127:
1125:
1124:
1123:
1109:
1108:
1107:
1106:
1097:
1096:
1089:
1077:
1076:
1069:
1058:
1057:
1053:
1041:
1040:
1036:
1024:
1023:
1019:
1007:
1006:
1002:
990:
989:
985:
970:
969:
965:
950:
949:
945:
933:
932:
928:
919:
918:
914:
905:
904:
900:
891:
890:
886:
877:
876:
872:
863:
862:
858:
849:
848:
844:
836:
832:
831:
827:
812:
811:
807:
798:
792:
788:
787:
783:
770:
763:
762:
758:
745:
744:
740:
731:
730:
726:
721:
694:
624:
623:
620:
617:
614:
611:
605:
604:
601:
598:
595:
592:
586:
585:
582:
579:
576:
573:
570:
567:
564:
546:
542:
538:
529:
522:
518:
515:
494:string literals
478:
472:
466:
461:
450:
439:
428:
423:
411:
396:. The rise of
385:
374:
342:
330:carriage return
326:
320:
275:
224:
136:
126:
113:
109:
101:
97:
89:
82:
67:
57:
45:escape sequence
35:
32:
23:
22:
15:
12:
11:
5:
1132:
1130:
1122:
1121:
1111:
1110:
1105:
1104:
1087:
1067:
1051:
1034:
1028:. 2011-02-05.
1017:
1000:
983:
963:
943:
926:
912:
898:
884:
870:
856:
842:
825:
805:
781:
756:
738:
723:
722:
720:
717:
716:
715:
710:
705:
700:
693:
690:
610:
591:
563:
521:since writing
514:
511:
465:
462:
459:
447:
446:
443:
427:
424:
422:
421:Quoting escape
419:
410:
407:
373:
370:
341:
338:
322:Main article:
319:
316:
274:
271:
246:applications.
223:
220:
211:dumb terminals
203:
202:
194:
193:
135:
132:
131:
130:
119:
118:
117:
86:
79:
77:
56:
53:
33:
24:
14:
13:
10:
9:
6:
4:
3:
2:
1131:
1120:
1117:
1116:
1114:
1100:
1094:
1092:
1088:
1084:
1080:
1074:
1072:
1068:
1063:
1062:
1055:
1052:
1048:
1044:
1038:
1035:
1031:
1027:
1021:
1018:
1014:
1010:
1004:
1001:
997:
993:
987:
984:
980:. 2013-06-09.
979:
978:
977:The Economist
973:
967:
964:
960:. 2009-10-29.
959:
958:
953:
947:
944:
940:
936:
930:
927:
922:
916:
913:
908:
902:
899:
894:
888:
885:
880:
874:
871:
866:
860:
857:
852:
846:
843:
835:
829:
826:
821:
820:
815:
809:
806:
802:
791:
785:
782:
778:
776:
766:
760:
757:
752:
748:
742:
739:
734:
728:
725:
718:
714:
711:
709:
706:
704:
701:
699:
696:
695:
691:
689:
687:
682:
680:
675:
673:
669:
665:
661:
659:
655:
651:
647:
643:
639:
635:
631:
627:
608:
589:
561:
559:
555:
550:
535:
526:
512:
510:
508:
504:
499:
495:
491:
487:
482:
477:
471:
463:
458:
456:
444:
437:
436:
435:
433:
425:
420:
418:
416:
408:
406:
404:
399:
395:
391:
383:
379:
371:
369:
367:
363:
359:
354:
351:
347:
339:
337:
335:
331:
325:
317:
315:
313:
309:
305:
300:
298:
294:
290:
286:
285:
280:
273:Modem control
272:
270:
268:
263:
261:
256:
252:
247:
245:
241:
237:
233:
229:
221:
219:
216:
212:
208:
199:
196:
195:
191:
187:
186:
185:
182:
180:
176:
171:
169:
165:
161:
157:
153:
149:
145:
141:
133:
124:
120:
107:
95:
87:
80:
75:
73:
72:
70:
63:
59:
58:
54:
52:
50:
46:
42:
37:
30:
19:
1082:
1060:
1054:
1046:
1037:
1029:
1020:
1012:
1003:
995:
986:
975:
966:
955:
946:
938:
929:
915:
901:
887:
873:
859:
845:
828:
817:
808:
796:
784:
774:
768:
759:
750:
747:"Characters"
741:
727:
683:
676:
662:
628:
625:
606:
587:
551:
527:
516:
506:
483:
479:
448:
429:
412:
375:
355:
343:
327:
301:
296:
292:
288:
282:
276:
264:
248:
225:
204:
198:Data General
183:
178:
174:
172:
163:
159:
137:
44:
38:
36:
658:equals sign
376:A utility,
297:online mode
267:Baudot code
123:ANSI escape
94:hexadecimal
719:References
646:PostScript
474:See also:
384:(by using
356:The later
152:peripheral
140:characters
49:characters
679:stropping
534:delimiter
503:backslash
464:In detail
260:heuristic
244:debugging
201:sequence.
148:computers
1113:Category
692:See also
484:In many
430:When an
426:Overview
378:ANSI.SYS
222:Keyboard
55:Examples
957:PCworld
532:) as a
513:Samples
394:Windows
388:in the
366:HP 2640
350:digraph
240:HP 2640
228:Esc key
168:keycaps
640:, and
558:Python
403:printf
390:PROMPT
192:modems
108:) and
837:(PDF)
793:(PDF)
612:print
593:print
574:World
571:Hello
565:print
415:xterm
358:VT100
308:VT100
304:modal
255:ASCII
230:on a
215:ASCII
213:used
144:state
106:octal
43:, an
670:use
666:and
642:Ruby
638:Java
554:Perl
543:\x22
519:'\''
509:").
492:and
346:VT52
344:The
277:The
156:data
110:\x5C
102:\134
90:\x5c
819:IBM
688:).
668:URI
664:URL
634:C++
556:or
552:In
549:).
523:'''
455:CMD
398:GUI
386:$ e
382:DOS
293:+++
289:+++
284:+++
179:CSI
175:two
146:of
96:),
76:not
60:In
39:In
1115::
1090:^
1081:.
1070:^
1045:.
1011:.
994:.
974:.
954:.
937:.
816:.
795:.
767:.
749:.
681:.
636:,
632:,
560:2
539:\"
505:("
314:.
269:.
236:vi
170:.
100:,
98:\\
83:\\
71:.
1101:.
1064:.
923:.
909:.
895:.
881:.
867:.
853:.
839:.
822:.
799:\
777:.
771:\
753:.
735:.
630:C
618:;
599:;
583:;
577:!
547:"
537:(
530:"
507:\
451:^
442:)
127:[
116:.
114:\
104:(
92:(
68:\
62:C
31:.
20:)
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.