Rodrigo Barbosa wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Sun, Sep 03, 2006 at 08:11:18AM +0800, John Summerfield wrote:
The correct behaviour for the backspace key is to send the BS character, 0x08 aka ^H.
^? I suspect is the DEL character, 0x7f, which is unprintable (or prints as a space). I would expect the Delete key to produce a DEL character.
The correct behaviour for who ? For many platforms (Sun is the first one that comes to memory), the correct backspace char was always ^?
By definition of the American National Standards Institute.
At least here, for me, DEL shows are ^[[3~ (ANSI code ?!?).
Those are character interpretations, not the underlying codes. They are ANSI control sequences for controlling terminals. I suspect they originated with the Digital Equipment Corporation, possibly with its VT100 glass teletypes.
The backspace character's original purpose was to tell a printer-keyboard to back space one position, so the next chracter would overtype the previous: it was exactly opposite to a space.
The DEL character is also known as RUBOUT. Why?
In the olden days, we used paper tape. Nobody wanted to throw out, or rekey, a roll of paper tape because of a small error. How do we fix a wrong character/ We rub it out. We punch holes across the tape, and so the value 0x7f (remember, ASCII is a seven-bit code). A program reading data from paper tape had to recongise special control characters; one of them was DEL, which it simply dropped.
Yes, on ASCII, DEL is 7F and BS is 08. But remember the issue here are not charsets, but console control codes, which usually are the same, but not always.
The definition is kind of iffy, but on the console_codes manpage it states that, for Linux BS should indeed produce ^H. But lets remember that is Linux specific, and might not be true to many other platforms.