Substitute character

From Wikipedia, the free encyclopedia
(Redirected from Control-Z)
Jump to navigation Jump to search

Template:Short description Script error: No such module "redirect hatnote". Script error: No such module "redirect hatnote". Template:Use dmy dates Template:Use list-defined references In computer data, a substitute character (␚) is a control character that is used to pad transmitted data in order to send it in blocks of fixed size, or to stand in place of a character that is recognized to be invalid, erroneous or unrepresentable on a given device. It is also used as an escape sequence in some programming languages.

In the ASCII character set, this character is encoded by the number 26 (Template:Mono hex). Standard keyboards transmit this code when the [[control key|Template:Keypress]] and Template:Keypress keys are pressed simultaneously (Template:Mono, often documented by convention as Template:Mono).[1] Unicode inherits this character from ASCII, but recommends that the replacement character (�, U+FFFD) be used instead to represent un-decodable inputs, when the output encoding is compatible with it.

Uses

End of file

Script error: No such module "Labelled list hatnote". Historically, under PDP-6 monitor,[2] RT-11, VMS, and TOPS-10,[3] and in early PC CP/M 1 and 2 operating systems (and derivatives like MP/M) it was necessary to explicitly mark the end of a file (EOF) because the native filesystem could not record the exact file size by itself; files were allocated in extents (records) of a fixed size, typically leaving some allocated but unused space at the end of each file.[4][5][6][7] This extra space was filled with Template:Mono16 (hex) characters under CP/M. The extended CP/M filesystems used by CP/M 3 and higher (and derivatives like Concurrent CP/M, Concurrent DOS, and DOS Plus) did support byte-granular files,[8][9] so this was no longer a requirement, but it remained as a convention (especially for text files) in order to ensure backward compatibility.

In CP/M, 86-DOS, MS-DOS, PC DOS, DR-DOS, and their various derivatives, the SUB character was also used to indicate the end of a character stream,Script error: No such module "Unsubst". and thereby used to terminate user input in an interactive command line window (and as such, often used to finish console input redirection, e.g. as instigated by the command COPY CON: TYPEDTXT.TXT).

While no longer technically required to indicate the end of a file, as of 2017, many text editorsTemplate:Which and program languages still support this convention, or can be configured to insert this character at the end of a file when editing, or at least properly cope with them in text files.Script error: No such module "Unsubst". In such cases, it is often termed a "soft" EOF, as it does not necessarily represent the physical end of the file, but is more a marker indicating that "there is no useful data beyond this point". In reality, more data may exist beyond this character up to the actual end of the data in the file system, thus it can be used to hide file content when the file is entered at the console or opened in editors. Many file format standards (e.g. PNG or GIF) include the SUB character in their headers to perform precisely this function. Some modern text file formats (e.g. CSV-1203[10]) still recommend a trailing EOF character to be appended as the last character in the file. However, typing Template:Keypress does not embed an EOF character into a file in either DOS or Windows, nor do the APIs of those systems use the character to denote the actual end of a file.

Some programming languages (e.g. Visual Basic) will not read past a "soft" EOF when using the built-in text file reading primitives (INPUT, LINE INPUT etc.),Script error: No such module "Unsubst". and alternate methods must be adopted, e.g. opening the file in binary mode or using the File System Object to progress beyond it.

Character 26 was used to mark "End of file" even though ASCII calls this character Substitute, and has other characters to indicate "End of file". Number 28 which is called "File Separator" has also been used for similar purposes.

Other uses

In Unix-like operating systems, this character is typically used in shells as a way for the user to suspend the currently executing interactive process.[11] The suspended process can then be resumed in foreground (interactive) mode, or be made to resume execution in background mode, or be terminated. When entered by a user at their computer terminal, the currently running foreground process is sent a "terminal stop" (SIGTSTP) signal, which generally causes the process to suspend its execution. The user can later continue the process execution by using the "foreground" command (fg) or the "background" command (bg).

The Unicode Security Considerations report[12] recommends this character as a safe replacement for unmappable characters during character set conversion.

In many GUIs and applications, Template:Keypress (Template:Keypress on macOS) can be used to undo the last action. In many applications, earlier actions than the last one can also be undone by pressing Template:Keypress multiple times. Template:Keypress was one of a handful of keyboard sequences chosen by the program designers at Xerox PARC to control text editing.

Representation

ASCII and Unicode representation of "substitute":

  • Octal code: 32
  • Decimal code: 26
  • Hexadecimal code: 1A, U+001A
  • Mnemonic symbol: SUB
  • Binary value: 11010

See also

References

Template:Reflist

Further reading

  1. Cite error: Invalid <ref> tag; no text was provided for refs named Microsoft_126449
  2. Cite error: Invalid <ref> tag; no text was provided for refs named DEC_1965_PDP-6
  3. Cite error: Invalid <ref> tag; no text was provided for refs named DEC_1969_PDP-10
  4. Cite error: Invalid <ref> tag; no text was provided for refs named Elliott_1998_CPM14
  5. Cite error: Invalid <ref> tag; no text was provided for refs named Elliott_1998_CPM22
  6. Cite error: Invalid <ref> tag; no text was provided for refs named DRI_1979_CPM20-IG
  7. Cite error: Invalid <ref> tag; no text was provided for refs named Hogan_1982_CP/M
  8. Cite error: Invalid <ref> tag; no text was provided for refs named Elliott_1998_CPM31
  9. Cite error: Invalid <ref> tag; no text was provided for refs named Elliott_1998_DOSPLUS
  10. Cite error: Invalid <ref> tag; no text was provided for refs named Mastpoint_2016_CSV-1203
  11. Cite error: Invalid <ref> tag; no text was provided for refs named UW_Unix
  12. Cite error: Invalid <ref> tag; no text was provided for refs named Unicode_USC