ncurses screen prints garbage
I actually have two reasons for posting this. One is to see if there's an actual name for characters like this:
Hopefully that will show up correctly for you. If not, it's a little box with four numbers in it, one in each corner. I don't know their name or their reason for showing up, so it's hard to look for help. My main problem, though, is that I wrote a program that prints some output to a console using ncurses as it runs. These characters show up on the console, seemingly at random, and disturb the whole thing. Sometimes I'll also get sets of characters like "[13;" I'm not printing anything bizarre on there, just strings and floating-point numbers. For example, here's some output from a console running now: Code:
-0.063158 -0.002083 6.009213 0.000000 Thanks |
I will speculate that ncurses does not know what type of terminal you are using. The odd-looking character you posted is a printable version of the 'escape', '\x1b', ASCII 27 character. Normally, the terminal will trap sequences of characters that begin with the escape character, and interpret these escape sequences to control the screen and manage cursor and text placement. Evidently, the sequence being sent to the terminal by ncurses is not being trapped by your terminal, and is instead being displayed in the only way it knows how.
What is the value of $TERM, and what kind of terminal/emulator is your application running on? --- rod. |
Those are probably UTF-8 characters. Try setting the locale of the terminal you're running in.
Code:
luser@lhost$ env|grep -i utf |
1 Attachment(s)
Thanks for the responses. Here is the information you requested. Note that the locale is already set to en_US.UTF-8, and that I'm using gnome-terminal.
Code:
$ echo $TERM Other thoughts? Thanks! |
Quote:
What happens if you use a different terminal type, such as an xterm? --- rod. |
xterm seems to display everything correctly. I don't get any of these anomalies. Do you happen to know why that might be the case? That is, what is gnome-terminal doing differently from xterm?
Thanks! |
It isn't correctly emulating an xterm. It's hard to say whether that is a bug, or whether it simply wasn't intended to do so. Perhaps it is the setting of $TERM that is incorrect. I've never really figured out which is the chicken and which is the egg. I don't have gnome terminal; have you checked to see whether it has a configurable emulation? Maybe it can be set to xterm emulation.
--- rod. |
All times are GMT -5. The time now is 06:04 PM. |