Saturday 30 January 2016

Editable garbage printed at bash prompt after printing binary file in an xterm

Sometimes I would have garbage printed at the bash prompt in xterm after printing a binary file, like

64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c62;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c

I've never got around to work out why, until now.

The reason is the presence of byte 9A in the file. See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html. This is the "DECID" control sequence, which should cause the terminal to send a response string (as if it had been typed by the operator). Equivalent to DA or "Send Device Attributes". The response string in this case is

64;1;2;6;9;15;18;21;22c

with some more bytes at the beginning (ESC ? or ESC >, I'm not sure which).

No comments:

Post a Comment