ncurses and FreeBSD

Hello everyone! It's been a couple months since I decided to move to FreeBSD from Linux, It's been a challenging task, but rewarding indeed.

I had a working FreeBSD installation on an old laptop, but a hard disk failure totally ruined it (silly me, for not doing backups)

I fixed the drive, now I want to install it again to it's previous state, save a backup and buy a new drive. But I have a problem.

I live in Spain, so I have an spanish keyboard (iso-8859-15 keymap), but the system language is set to en_US (i want it that way). The problem is that ncurses applications don't draw lines, they don't display any characters or weird ones like ÄÄÄÄÄ3 instead of lines, same happens to the 'make config' dialog

Here's what I've done:

Installed the /devel/ncurses port
set the TERM variable to cons25l1 (for iso15 compatibility)
set the LANG variable to en_US.ISO8859-15
set the CHARSET variable to ISO-8859-15
current font is iso15
no screenmap applied
with this configuration, no boxes are displayed, where there should be a line (in ncurses), there's nothing visible

On the previous installation I had some sort of a mess-up and I wasn't able to display spanish-like characters like accents or ñ or ç, now I can, but ncurses won't get it

I've gone through lots of googling and I've read things about how ncurses uses UTF-8 encoding and stuff but I don't know what to do.

I want:

ncurses working and still being able to print accents and stuff

If anyone needs screenshots I'll gladly upload them
 
cons25 is for the console (the non-X version). There are a couple of alternative console drivers, just in case you've got one. Only the "real" cons25 will do line-drawing in exactly the same way as the terminal description says. That's one place to check.

Another is the locale settings - you've only cited one of the variables. The "locale" program prints all of those. LC_CTYPE may differ from LANG, and it's LC_CTYPE that's used.

None of your settings appear to be related to UTF-8.
 
Hmm I checked the LC variables using the 'locale' command, all of them are set to en_US.ISO8859-15
 
OK, I've been tinkering a little, and I fixed the issue setting the cons25 driveer and changing iso15 font to cp850, but now I can't type special spanish characters like àáñç and so forth...
 
The problem may be in a different area. It seems that FreeBSD's termcap for this entry is incomplete. (FreeBSD installs termcap and terminfo, the latter from ncurses, but prefers to use termcap).

Here is what I'm looking at:

Code:
# ISO 8859-1 FreeBSD console with ACS support
cons25l1|cons25-iso8859-1:\  
        :ac=f\260g\261}\243+\253,\273i\247:\
        :tc=cons25w:
The "ac" string is the one that does line-drawing. ncurses' terminfo has a much longer string. The short ac string only corresponds to these
(from curses.h):

Code:
#define ACS_DEGREE      NCURSES_ACS('f') /* degree symbol */
#define ACS_PLMINUS     NCURSES_ACS('g') /* plus/minus */
#define ACS_STERLING    NCURSES_ACS('}') /* UK pound sign */
#define ACS_RARROW      NCURSES_ACS('+') /* arrow pointing right */
#define ACS_LARROW      NCURSES_ACS(',') /* arrow pointing left */
#define ACS_LANTERN     NCURSES_ACS('i') /* lantern symbol */
 
Hmm - I don't see a good solution. Each of the cons25 flavors uses line-drawing characters from the codes in 160-255. But you're using those for ISO-8859-1 (and presumably the font is complete). If ncurses is using the terminfo, then it would not match that font (and you'd see odd characters, but no line-drawing).

None of the ISO-8858-x flavors have line-drawing characters. For those, you'd use one of the Windows code-pages (for instance cons25 assumes CP437. If you happened to have a font for CP1252, then it would be possible to make a terminal description for that which could have line-drawing, as well as the ISO-8859-15.
 
I did something, I compiled ncurses using terminfo, changing this in the makefile:

Code:
--with-hashed-db
to
Code:
--without-hashed-db

now, with the mentioned configuration, ncurses still doesn't draw any lines, but makes an ASCII approximation drawing +---------------+, that should be what you said that only the cons25 driver draws lines, but with the cons25 driver I can't print spanish characters with the cp850 font. Any ideas?
 
yes - ncurses will use +'s and -'s when it knows that it cannot draw lines. cp850 is much like cp437 - it doesn't have the characters in the right places to look like one of the ISO-8859-x's. (Googling on these finds several places that show charts of the characters - it's better to look at those and see how those two codepages compare to ISO-8859-1 / 15).
 
The FreeBSD base system comes with its own version of ncurses, and I have no trouble when that's the one I use. However, once I installed x11/rxvt-unicode which brought in devel/ncurses as a dependency, and subsequently compiled ncurses programs exhibited the same behaviour you see. My solution was to uninstall devel/ncurses and all its dependent ports and to reinstall all of my broken ncurses programs.

I'd surely like to know if there is a better solution.
 
Yeah, there are some ports that call out devel/ncurses as a dependency, and it isn't always clear why.

mail/mutt is a good example. It works fine with the ncurses supplied with FreeBSD 8.x, not so fine with the ncurses from ports. Even when I build the ncurses port with 256-colors enabled, using it with mutt only gets me 16 colors.

(Using slang with mutt gives me even worse results: it never gets my colorscheme right, and uses colors that aren't anywhere close to what I specified. E.g., a "white" background is displayed as fire-engine red!)
 
I think I'm going to go the long way.

If I want lines on ncurses programs, I'd better use cons25, if I do, I won't get latin characters displayed correctly (instead of á I see the "beta" character), so, you'll think I'm mad, but I'll edit the syscons cp850 font

I've checked that the á character in other documents is also displayed as "beta" in my computer, so I'll edit the fonts replacing glyphs untill I get the correct display.

I've already done that character and it works, I see characters displayed correctly.

It's gonna be long, but I'll be able to see the correct latin characters on the cons25 driver, and also have lines and no dependency
 
Bad idea, changing fonts also changes the line characters and stuff, which puts me on the start line...

the original ncurses library also carries this problem, as setting a latin font (iso15) in the install DVD Fixit console also messes up sysinstall characters...
 
I'll try converting the spanish.iso15.acc keymap to ones that matches CP 437 characters, with correct conversion other computers also work with mine
 
Nevermind, I turned over to 'jfbterm' a terminal emulator for console, which fully complies UTF-8 and ISO encodings without interfering with ncurses, can't switch to UTF-8 as there's no such keymap available, but ISO works for me.
 
Hello!

davidbliss said:
The FreeBSD base system comes with its own version of ncurses, and I have no trouble when that's the one I use. However, once I installed x11/rxvt-unicode which brought in devel/ncurses as a dependency, and subsequently compiled ncurses programs exhibited the same behaviour you see. My solution was to uninstall devel/ncurses and all its dependent ports and to reinstall all of my broken ncurses programs.

I'd surely like to know if there is a better solution.

I had similar problem yesterday when did update my system and, somehow, some of the ports pulled devel/ncurses. After that I experienced the strange problem in Weechat client (see picture - every 2nd line of text in the chat area became green.

Now, I uninstalled devel/ncurses and re-installed weechat - the color problem is solved, but I believe that finishing the above task, will fully resolve it.

However, the problem remains: why some ports are pulling devel/ncurses and how to solve it?

P.S.:The problem is solved by the above workaround, but that's not the real solution.
 
Back
Top