About SUB

Integer ASCII code: 26
Binary code: 0001 1010
Octal code: 32
Hexadecimal code: 1A
Group: control
Seq: ^Z

Unicode symbol: , int code: 9242 (html &#9242) hex code: 241A (html &#x241A)


Substitute character was initially created in order to use as a transmission control character to reflect that distorted or invalid characters had been received. In addition to its main function, substitute has frequently been used in order to achieve some other goals. It is used to show the end of file in case when in-band signaling of errors that it causes isn't necessary, particularly when a person uses some rough methods of error detection and correction. There may be another case where errors occur rare enough to make using the character for other purposes recommended. It is also used in DOS, Windows and other CP/M derivatives in order to indicate the end of file, in cases either when typing on the terminal or sometimes in text files stored on disk.

A substitute character (␚) is a control character. It is represented in the place of a character that is identified to be invalid or incorrect, or in cases when it can't be represented on a device used. Besides, it's used in the role if an escape sequence in some programming languages.

This character is encoded by the number 26 (1A hex) in the ASCII character set. Standard keyboards send this code while simultaneously pressing the Ctrl and Z keys. Ctrl+Z, is traditionally often described as ^Z). Unicode encodes this character either, but recommends to use the replacement character (, U+FFFD) instead of representing un-decodable inputs, in cases when the output encoding is compatible with it.

End of file

If we remember history, we will see that under PC CP/M 1 and 2 operating systems of those times (and derivatives like MP/M) it was necessary to clearly denote the end of a file (EOF). There was a reason for that: the CP/M filesystem couldn't record the exact file size by itself; files were distributed in size (records) of a fixed size. Usually some distributed but unused space was left at the end of each file. This extra space was filled with 1A16 (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) supported byte-granular files. It started to be just a physical requirement but a simple convention (particularly for text files) in order to ensure backward compatibility.

The SUB character was also used in CP/M, 86-DOS, MS-DOS, PC DOS, DR-DOS, and their different derivatives, in order to show the end of a character stream, and thus used to cease user input in an interactive command line window (this way, frequently used to end up console input redirection, e.g. as instigated by COPY CON: TYPEDTXT.TXT).

This convention is still supported by lots of text editors and programs, despite the fact that nowadays indicating the end of a file is no longer technically needed. Besides, this can be set up in order to put this character at the end of a file during editing process, or at least cope with them in text files in a right way. In such cases, it is often called a "soft" EOF, because it doesn't definitely show the end of the file in its physical sense. It should be treated as a marker more, showing that "there is no useful data beyond this point". However, in real use the situation is a little bit different, while some more data may exist beyond this character up to the real end of the data in the file system. This way it can be used in order to conceal some content when the file is entered through the console or opened in some editors. For implementing this very function, lots of file format standards (e.g. PNG or GIF) include the SUB character in their headers. Some modern text file formats (e.g. CSV-1203), that nowadays are used everywhere, however, still recommend a trailing EOF character to be added as the last character in the file. Besides, worth mentioning is the fact, that typing Control+Z doesn't implement an EOF character into a file neither in case of MS-DOS or Microsoft Windows, nor in case of APIs of those systems use the character to indicate the actual end of a file.

There are some programming languages (e.g. Visual Basic) that won't be able to read past a "soft" EOF in process of using the built-in text file reading primitives (INPUT, LINE INPUT etc.). This way some alternative methods must be taken over. There are can be lots of them, for example opening the file in binary mode or using the File System Object in order to move forward beyond it.

Character 26 was used in order to mark "End of file". The ASCII considered in to be a Substitute, and has other characters for this, but still Character 26 works well. Character 28 which is called "File Separator" has been used as well for achieving such goals.

Other uses

This character can be used in Unix operating systems. Here it's usually used in order to terminate the currently executing interactive process. The terminated process can be resumed later in foreground (interactive) mode. What's more, the execution can be resumed by it in background mode, or be terminated. When a user enters at his computer terminal, the currently running foreground process is sent a "terminal stop" (SIGTSTP) signal. In plain words, it makes the process to terminate its execution. The user can continue the process execution later with the help of the "foreground" command (fg) or the "background" command (bg).

The Unicode Security Considerations report recommends to use this character in the role of a safe replacement for characters, which are not applicable during character set conversion.

In lots of GUIs and applications Control+Z (⌘ Command+Z on Mac OS) can be used in order to cancel the last performed action. In lots of applications previously done actions, than the last one can be cancelled as well. The operator only has to press Control+Z for a couple of times. In order to control text editing, program designers at Xerox PARC picked Control+Z keyboards sequence. It was just one of a bunch of existing keyboard sequences. Perhaps the reason for choosing these very key combinations is their location on a standard QWERTY keyboard, because the Z (undo), X (cut), C (copy), and V (paste) keys are placed closed to each other at the left end of the bottom row.


input value base type output hash
SUB char MD5 bebe43a13d6320b4c6751958bf5398a7
SUB char SHA1 ebdc2288a14298f5f7adf08e069b39fc42cbd909
26 dec MD5 4e732ced3463d06de0ca9a15b6153677
26 dec SHA1 887309d048beef83ad3eabf2a79a64a389ab1c9f
00011010 bin MD5 665f5462d2e4e2d70e2b81614e2fe174
00011010 bin SHA1 405bec816ada94b49ce72db06e003b910ad18070
0001 1010 bin MD5 a4cb49911e3bac8e3d964decf3e3e4de
0001 1010 bin SHA1 6cf5280d7342d299f335c19113501b7c8dce8186
32 oct MD5 6364d3f0f495b6ab9dcf8d3b5c6e0b01
32 oct SHA1 cb4e5208b4cd87268b208e49452ed6e89a68e0b8
1A hex MD5 0723dfd10075aee37a1804a728349dc3
1A hex SHA1 049efd082748b3db82a4edbdafedbd51e8e8d4ba
0x1A hex MD5 cde0ca77dd54c00e672f34cd314410f9
0x1A hex SHA1 11aee9e9e43d40497b25cc6e31e9df22c2e9e93c
Back to ASCII table

 2018 © Dmytro Koshovyi. Ukraine, Mykolayiv.