On 25-Jul-2000 Sven Burgener wrote: > On Tue, Jul 25, 2000 at 04:38:32PM -0400, Dan Brosemer wrote: >> > It seems to display things fine, but just with weird characters instead >> > of proper ones. Some characters are fine though, like the "GNU" part of >> > the login prompt. :) > >> Press ^V then ^O then ENTER at the prompt. > >> The system will echo back: >> bash: ^O: command not found > > Yes! That's cool. Thanks. > >> You've just got the system to send a ^O character to the screen which will >> reset it gracefully. > > Yes, but also ^V before the ^O, like you said. > Do you know why? Anyone know why? >
Each unix terminal has two charsets: a normal one, with the standard ascii stuff, and a 'graphical' one, with those funny characters. The linux VT is no exception from this, with two charset slots called G0 and G1. Switching between carsets is done by sending the terminal the right control code. You can find out what these are by disassembling the corresponding terminfo database (found in /usr/share/terminfo) with infocmp(1). eg. 'terminfo linux > linux.ti' for the linux console. The "smacs" code is for switching to the alternate charset, and the "rmacs" is for switching to the normal one. eg. in my linux.ti rmacs=^O and smacs=^N. The ^V character is a property of the tty line. Just do a 'stty -a' and look for the "lnext" code. This causes the next character to be sent literally to the terminal, even if it's a control character. So to switch to the 2nd carset type ^V^N, to switch back ^V^O. HTH Lehel