简体   繁体   中英

using ncurses in a virtual terminal

I'm new to Linux and virtual terminals as well as to Curses, so please forgive me if this description isn't clear as it could be. I'm trying to use Curses on Fedora 12 to output status information to a virtual terminal (you know one of the terminals you can get to by pressing ctrl-alt-Fx). When I start up my application on one of the virtual terminals ($TERM=linux), the lines for the boxes come out as the characters 'j', 'q', 'k'....(and a few other characters). Yet when I start it within a terminal window ($TERM=xterm), everything displays as it should. Can someone explain to me what I need to do to get the VT output to appear as the xterm? Is there a terminal setting that I can set from within my program to cause the output to be correct? Any help would be greatly appreciated.

This is an ncurses FAQ: Line-drawing characters come out as x's and q's :

The x's and q's correspond to a table (from terminfo/termcap) which tells ncurses how to map the “alternate” character set to the terminal's set of graphic characters. The reference for this table comes from the vt100. If the unmapped characters appear, then the terminal emulator does not recognize the escape sequence for switching between normal and alternate fonts that is given in the terminfo description.
...

  • Terminal emulators which use a different escape sequence or different range for mapping the resulting characters. For instance the so-called vt100-compatibles such as Linux console and Tera Term.
  • Terminal emulators which are locale-sensitive. Again, Linux console is a problem area when running in UTF-8 mode, since its nominal vt100-compatibility is further lessened by ignoring the escape sequences dealing with fonts. The screen utility also has the same problem; whether to make the implementation simple or to copy the Linux console. It ignores vt100-style font switching when the locale is a UTF-8 flavor.

But for the Linux console, it is largely obsolete, given the improvements made to the terminal database in 2011:

20110205

  • add xterm-utf8 entry as a demo of the U8 feature -TD
  • add U8 feature to denote entries for terminal emulators which do not support VT100 SI/SO when processing UTF-8 encoding -TD
  • improve the NCURSES_NO_UTF8_ACS feature by adding a check for an extended terminfo capability U8 (prompted by mailing list discussion ).

Although that change was from February 2011 (six months before OP's question), Fedora 12 provided a development version of ncurses 5.7 (2009/02/09 versus 2008/11/2) packaged in August 2009 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM