ncurses 应用程序中的字符仅在 tmux 中正确显示

问题描述 投票:0回答:2

作为 Berrymuch 项目的一部分,我已将 calcurse 应用程序移植并交叉编译到 Blackberry 10 (https://github.com/BerryFarm/berrymuch/tree/master/ports-wip/calcurse),但是我面临着显示伪图形字符的问题。在 term48 终端应用程序 (TERM=xterm-256color) 中启动时,分隔符显示为字母。 broken output

但是,如果在 tmux 中启动同一个应用程序,则分隔符看起来很好。 ok output

我尝试在终端本身中使用 TERM=screen 运行,但这并没有解决问题。

有人有可能出错的理论吗?

我怀疑 a) bb10 上的 ncurses 存在问题 b) 应用程序中的 ncurses 功能检测损坏 c) 终端功能检测损坏 d) 系统中缺少区域设置信息

LC_ALL
设置为
en_US.UTF-8
。设置
NCURSES_NO_UTF8_ACS=1
也没有帮助。
ldd
显示 calcurse 与
libncursesw.so.1

相关
encoding ncurses blackberry-10 tmux
2个回答
1
投票

我认为您的 NCURSES_NO_UTF8_ACS 方向正确 - 如果 tmux 认为终端支持 UTF-8(因为您的 LANG 包含 UTF-8),则默认情况下它会使用 UTF-8 来绘制 ACS,所以听起来您的终端支持 UTF- 8 但不能正确支持 ACS。在 tmux 之外是否可以执行以下操作(它应该显示符号而不是 ASCII):

tput enacs; tput smacs; tput acsc; tput rmacs; echo

现代ncurses也应该使用UTF-8,我不知道为什么不是。您可能想检查您正在使用的 ncurses 版本,也许尝试更新的版本,还有 U8 terminfo(5) 功能,您可以尝试将其设置为 0 或 1 的自定义条目。


0
投票

“term48”是一个特殊的终端模拟器,它(参见源代码)将

TERM
设置为“xterm-256color”(像往常一样,不是一个好主意)。

在这种情况下,您可以在源代码中看到它没有实现画线:

  • SI/SO:移入和移出 (VT100)
/*
SO - SHIFT-OUT
Notation: (C0)
Representation: 00/14
SO is used for code extension purposes. It causes the meanings of the bit
combinations following it in the data stream to be changed.
The use of SO is defined in Standard ECMA-35.
NOTE SO is used in 7-bit environments only; in 8-bit environments LOCKING-SHIFT
ONE (LS1) is used instead.
*/
void ecma48_SO(){
  ecma48_NOT_IMPLEMENTED("SO");
}

/*
SI - SHIFT-IN
Notation: (C0)
Representation: 00/15
SI is used for code extension purposes. It causes the meanings of the bit
combinations following it in the data stream to be changed.
The use of SI is defined in Standard ECMA-35.
NOTE SI is used in 7-bit environments only; in 8-bit environments LOCKING-SHIFT
ZERO (LS0) is used instead.
*/
void ecma48_SI(){
  ecma48_NOT_IMPLEMENTED("SI");
}
  • SCS(VT220 及更高版本)
      case ECMA48_STATE_ANSI_SCS:                                               
        switch(tbuf[i]){                                                        
          default: ecma48_NOT_IMPLEMENTED("SCS");                               
        }; break;

如果没有这些功能,终端应用程序将只能使用 UTF-8 来进行线条绘制。

ncurses 确实有一个解决方法,但它依赖于调用

setlocale
的应用程序。 berrymuch 端口禁用该功能(参见 build.sh):

CONFIGURE_CMD="./configure
                --host=$PBHOSTARCH
                --build=$PBBUILDARCH
                --target=$PBTARGETARCH
                --prefix=$PREFIX
                --disable-nls
                CC=$PBTARGETARCH-gcc"

正因为如此,它也没有提供在 ncurses 中使用 UTF-8 的方法。

© www.soinside.com 2019 - 2024. All rights reserved.