Lon*_*ner 10 putty gdb character-encoding
我使用PuTTY登录远程CentOS系统,并使用g ++和gdb进行开发.我的PuTTY设置为将终端输出解释为UTF-8并相应地渲染它.此设置配置如下.

在调试时gdb --tui我发现源代码窗格周围的边框没有用线条正确绘制.它看起来像终端字符编码问题.
终端能够正确显示Unicode字符.以下是一些示例输出:
[root@gel ~]# python -c "print u'\u2665'"
?
[root@gel ~]# printf "\xe2\x99\xa5\n"
?
Run Code Online (Sandbox Code Playgroud)
这是我的终端设置:
[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
Run Code Online (Sandbox Code Playgroud)
然而,当我启动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---
Run Code Online (Sandbox Code Playgroud)
您可以看到源代码窗格周围的边框是用q和x绘制的.
如何解决此问题,以便gdb -tui输出使用正确的线条绘制边框?
现在,我正在解决这个问题,通过配置PuTTY将终端数据解释为ISO-8859-1,如下所示.使用此设置,终端输出如下所示.

[root@gel ~]# python -c "print u'\u2665'"
â¥
[root@gel ~]# printf "\xe2\x99\xa5\n"
â¥
Run Code Online (Sandbox Code Playgroud)
使用此设置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---
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1882 次 |
| 最近记录: |