Code::Blocks 终端中文乱码
Tofloor
poster avatar
stivenke
deepin
2016-11-06 03:12
Author
本帖最后由 stivenke 于 2016-11-5 19:22 编辑

由于 Code::Blocks 使用默认的 xterm 做为终端,在 deepin 中安装完 Code::Blocks,在确保源码的格式为 UTF-8 且 Code::Blocks 中的配置 Settings -> Editor... -> General Settings -> Encoding settings 也是 UTF-8 后,编译后一般也还会出现部分中文乱码的问题。

目前的采用的解决方法是,将终端换成深度的终端:在 Code::Blocks 中配置 Settings -> Evironment Settings -> General Settings -> Terminal to launch console programs 为:
deepin-terminal -t $TITLE -x

在 Code::Blocks 中按 F9 就可以在深度的终端中显示正常的中文结果。

当然,在源码格式为GBK(Windows-936)时,可以考虑在 Code::Blocks 中配置 Settings -> Compiler... -> Global compiler settings -> Compiler settings -> Other compiler options 添加参数:
-finput-charset=GBK
-fexec-charset=UTF-8

避免大量修改源码。


Reply Favorite View the author
All Replies
avatar
tonghoil
deepin
2016-11-06 06:54
#1
嗯,我换成深度终端也解决了乱码问题,还有把c/c++源文件放在桌面好像编译和运行不起来,放在其他目录可以,很奇怪...
Reply View the author
avatar
stivenke
deepin
2016-11-08 06:23
#2
https://bbs.deepin.org/post/45281
嗯,我换成深度终端也解决了乱码问题,还有把c/c++源文件放在桌面好像编译和运行不起来,放在其他目录可以 ...

我直接把 .c 源代码(单个文件)放到桌面上(/home/[yourname]/Desktop)上,在Code::Blocks中以单文件打开是可以编译的(先是 Ctrl+F9 再 Ctrl+F10),没有问题。
Reply View the author
avatar
也无风雨也无晴,归去
deepin
2021-06-06 19:55
#3

现在终端已经不能设置标题了。。没有-t 参数了。。

终端是一款集工作区、多窗口、远程管理、雷神模式等功能的高级终端模拟器。

 

选项:

  -h, --help                      Displays help on commandline options.

  --help-all                      Displays help including Qt specific options.

  -v, --version                   显示版本信息。

  -w, --work-directory      设置终端的启动目录

  -e, --execute          在终端中运行⼀个程序

  -q, --quake-mode                设置终端以雷神模式启动

  -m, --window-mode   设置终端开启的模式 (normal, maximum, fullscreen,

                                  splitscreen)

  --keep-open                     设置终端显示命令或脚本执行后的结果

  -C, --run-script *       在终端中允许脚本字符串

 

Reply View the author