Ever wonder why the DEL (delete) character is shown as ^? if your terminal settings are messed up? Control characters are not arbitrary: the control key of a classic ASCII terminal was implemented as just (ASCII code of character typed) XOR 64. So ^A is 65 (ASCII 'A') XOR 64 = 1. ^@ is 64 XOR 64 = 0 (NUL), and ^? is 63 XOR 64 = 127 which is DEL. That's why not all punctuation characters have control-character equivalents. Early terminals didn't support lower case, so ^a is the same as ^A.
Conversation
Notices
-
Embed this notice
Garrett Wollman (wollman@mastodon.social)'s status on Friday, 06-Dec-2024 06:09:12 JST Garrett Wollman
- Xenotar repeated this.
-
Embed this notice
Garrett Wollman (wollman@mastodon.social)'s status on Friday, 06-Dec-2024 06:09:12 JST Garrett Wollman
Some punctuation characters have control-character equivalents but most don't, simply because of how the ASCII table is laid out: there are only 33 control characters (values 0 through 31 plus 127) and most punctuation characters don't have values that land in that range when XORed with 64. Some terminals used this combinations for other things but mostly they were not implemented. (One important exception is that control-SPACE, which should be "`" (backtick) is often mapped to NUL.)