Character encoding gdb——当PuTTY terminal设置为使用UTF-8时,tui无法显示具有正确线条的边框 问题

Character encoding gdb——当PuTTY terminal设置为使用UTF-8时,tui无法显示具有正确线条的边框 问题,character-encoding,gdb,putty,Character Encoding,Gdb,Putty,我使用PuTTY登录到远程CentOS系统,并使用g++和gdb进行开发。我的PuTTY设置为将终端输出解释为UTF-8,并相应地进行渲染。此设置的配置如下所示 在使用gdb--tui进行调试时,我发现源代码窗格周围的边框没有正确地用线条绘制。这看起来像是终端字符编码问题 终端能够正确显示Unicode字符。以下是一些示例输出: [root@gel ~]# python -c "print u'\u2665'" ♥ [root@gel ~]# printf "\xe2\x99\xa5\n" ♥

我使用PuTTY登录到远程CentOS系统,并使用g++和gdb进行开发。我的PuTTY设置为将终端输出解释为UTF-8,并相应地进行渲染。此设置的配置如下所示

在使用
gdb--tui进行调试时,我发现源代码窗格周围的边框没有正确地用线条绘制。这看起来像是终端字符编码问题

终端能够正确显示Unicode字符。以下是一些示例输出:

[root@gel ~]# python -c "print u'\u2665'"
♥
[root@gel ~]# printf "\xe2\x99\xa5\n"
♥
以下是我的终端设置:

[root@gel ~]# echo $LANG
en_US.UTF-8
[root@gel ~]# echo $LC_CTYPE

[root@gel ~]# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
[root@gel ~]# echo $TERM
xterm
但是,当我启动
gdb-tui

   lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
   x                                                                           x
   x                                                                           x
   x                                                                           x
   x                                                                           x
   x                                                                           x
   x                                                                           x
   x             [ No Source Available ]                                       x
   x                                                                           x
   x                                                                           x
   x                                                                           x
   x                                                                           x
   x                                                                           x
   x                                                                           x
   mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
None No process In:                                           Line: ??   PC: ??
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
---Type <return> to continue, or q <return> to quit---
通过此设置,
gdb--tui
输出看起来正常

   ┌───────────────────────────────────────────────────────────────────────────┐
   │                                                                           │
   │                                                                           │
   │                                                                           │
   │                                                                           │
   │                                                                           │
   │                                                                           │
   │             [ No Source Available ]                                       │
   │                                                                           │
   │                                                                           │
   │                                                                           │
   │                                                                           │
   │                                                                           │
   │                                                                           │
   └───────────────────────────────────────────────────────────────────────────┘
None No process In:                                           Line: ??   PC: ??
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
---Type <return> to continue, or q <return> to quit---
┌───────────────────────────────────────────────────────────────────────────┐
│                                                                           │
│                                                                           │
│                                                                           │
│                                                                           │
│                                                                           │
│                                                                           │
│             [没有资料来源]│
│                                                                           │
│                                                                           │
│                                                                           │
│                                                                           │
│                                                                           │
│                                                                           │
└───────────────────────────────────────────────────────────────────────────┘
无:行中没有进程:??个人电脑:??
GNU gdb(gdb)Red Hat Enterprise Linux(7.2-60.el6_4.1)
版权所有(C)2010免费软件基金会。
许可证GPLv3+:GNU GPL版本3或更高版本
这是自由软件:您可以自由更改和重新发布它。
在法律允许的范围内,不存在任何担保。键入“显示复制”
和“显示保修”了解详细信息。
此GDB配置为“x86_64-redhat-linux-gnu”。
---键入以继续,或键入q以退出---
根据(链接在@jpe的评论中),问题在于“一些终端仿真器(如Putty)在UTF-8模式下不遵守ACS控制序列”。这就提出了两种可能的解决方案:

  • 将腻子从UTF-8模式中取出。这似乎就是你的变通方法的效果

  • 停止GDB使用ACS控制序列。根据,这可以通过命令
    set tui border kind ascii
    完成。文档没有注意到在进入TUI模式之前必须发出此命令


  • 当您将tui边界类型从ascii切换到acs时会发生什么情况?
    $TERM
    变量的值可能也很重要。@Phillip
    echo$TERM
    在这两种情况下都输出
    xterm
    。将此信息添加到问题中。@mockinterface如何将tui边界类型从ascii切换到acs?你能给我提供一些步骤吗?似乎是相关的:
       ┌───────────────────────────────────────────────────────────────────────────┐
       │                                                                           │
       │                                                                           │
       │                                                                           │
       │                                                                           │
       │                                                                           │
       │                                                                           │
       │             [ No Source Available ]                                       │
       │                                                                           │
       │                                                                           │
       │                                                                           │
       │                                                                           │
       │                                                                           │
       │                                                                           │
       └───────────────────────────────────────────────────────────────────────────┘
    None No process In:                                           Line: ??   PC: ??
    GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-redhat-linux-gnu".
    ---Type <return> to continue, or q <return> to quit---