Binary-cat Console Junkedness... [(Sort of) OFF-TOPIC]

1998-12-30 Thread Ryan King
Knowing the answer to this question doesn't matter much, but I am
curious...

Why does a VC go bonkies when you cat a binary file from it?  What doesn't
make sense to me is that only some of the chars display wrong, and that
it's only the display that is ruined, but the actual characters are intact
as far as bash is concerned.

I know all you have to do to un-junk it is `echo C-v ESC c`, (which helped
me a lot before I learned about the `file` command), but I'm still curious.

Anyone know what is happening?

-Ryan



Re: Binary-cat Console Junkedness... [(Sort of) OFF-TOPIC]

1998-12-30 Thread Havoc Pennington

On Wed, 30 Dec 1998, Ryan King wrote:
 Why does a VC go bonkies when you cat a binary file from it? 

Terminals can be modified in various ways by sending them special command
sequences (control characters). You can tell the terminal to use
boldface, change size, and lots of more arcane things. Most programs do
this in a controlled way.

When you cat a binary file, it often happens to contain some random
control sequences that don't make any sense, so the terminal ends up in a
broken state. The problem isn't limited to virtual consoles, it happens to
all terminals, including xterm, etc.

Havoc

 


RE: Binary-cat Console Junkedness... [(Sort of) OFF-TOPIC]

1998-12-30 Thread Shaleh

On 30-Dec-98 Ryan King wrote:
 Knowing the answer to this question doesn't matter much, but I am
 curious...
 
 Why does a VC go bonkies when you cat a binary file from it?  What doesn't
 make sense to me is that only some of the chars display wrong, and that
 it's only the display that is ruined, but the actual characters are intact
 as far as bash is concerned.
 
 I know all you have to do to un-junk it is `echo C-v ESC c`, (which helped
 me a lot before I learned about the `file` command), but I'm still curious.
 
 Anyone know what is happening?

Some of the sequences in the file are seen as escape sequences, that is why. 
Ascii 26 is Ctrl-Z -- but the binary number 26 good exist and be in the file. 
So when that gets output a Ctrl-Z is entered in the console.  And so on and so
forth.