screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interesting things found in ncurses that affect screen


From: Nikolai Weibull
Subject: Interesting things found in ncurses that affect screen
Date: Sun, 17 Jul 2005 21:19:38 +0200
User-agent: Mutt/1.5.8i

OK, so once again something weird happened while I was using a ncurses
application in screen.  It's been working fine for a long time and then
boom, something weird's going on, I'm not getting pretty line-drawing
characters any more.  So I swear a bit and begin looking into screen,
ncurses, and the applications code and come up with this wonderful piece
of code from ncurses:

ncurses-5.4/ncurses/tinfo/lib_setup.c:

/*
 * Check for known broken cases where a UTF-8 locale breaks the alternate
 * character set.
 */
NCURSES_EXPORT(int)
_nc_locale_breaks_acs(void)
{   
    char *env = getenv("TERM");
    if (env != 0) {
        if (strstr(env, "linux"))
            return 1;           /* always broken */
        if (strstr(env, "screen") != 0
            && ((env = getenv("TERMCAP")) != 0
                && strstr(env, "screen") != 0)
            && strstr(env, "hhII00") != 0) {
            return 1;
        }
    }
    return 0;
}

So, what's the deal?  Beyond the fact that this check is utterly
idiotic, as I could simply unset TERMCAP and the test would fail, I
really don't understand what the problem is with using UTF-8 in ncurses
inside screen.  Is there actually a valid reason for ncurses to do this
test?  If so, why hasn't the problem been fixed inside screen instead of
ncurses hacking its way around the supposed issue with screen?

The weird thing is that if i unset TERMCAP, the test fails, and I get
back my wonderful line-drawing characters instead of those stupid +, |,
and -'s.  I guess that the problem has something to do with the ACS
characters that the last strstr is checking for (h, I, and 0), but as
far as I know they work fine in UTF-8 mode inside screen.

Thanks for any additional information on what the hell is going on here,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]