Which ASCII Characters are Obsolete?
ascii, character-encoding, text
Solution
Out of the characters between hexadecimal 00 and 1F, the only ones you are likely to encounter frequently are NUL (`0x00 = \0`), TAB (`0x09 = \t`), CR (`0x0D = \r`), and LF (`0x0A = \n`). Of these, NUL is used in C-like languages as a string terminator, TAB is used as a tab character, and CR and LF are used at the end of a line. (Which one is used is a complicated situation; see the Wikipedia article Newline for details, including a history of how this came to be.)
The following additional characters are used when communicating with VT100-compatible terminal emulators, but are rarely found outside that context:
- BEL (`0x07 = \a`), which causes a terminal to beep and/or flash.
- BS (`0x08 = \b`), which is used to move the cursor left one position. (It is not sent when you press the backspace key; see below!)
- SO and SI (`0x0E` and `0x0F`), which are used to switch into certain special character sets.
- ESC (`0x1B = \e`), which is sent when pressing the Escape key and various other function keys, and is additionally used to introduce escape sequences which control the terminal.
- DEL (`0x7F`), which is sent when you press the backspace key.
The rest of the nonprintable ASCII characters are essentially unused.
Problem
My understanding is that the ASCII characters found in the range from 0x00 to 0x1f were included with Teletype machines in mind. In the modern era, many of them have become obsolete. I was curious as to which characters might still be found in a conventional string or file. From my experience programming in C, I thought those might be NUL, LF, TAB, and maybe EOT. I'm especially curious about BS and ESC, as I thought (similar to shift or control maybe) that those might be handled by the OS and never really printed or be included in a string. Any amount of insight would be appreciated! Table for reference: