简体   繁体   English

emacs中ansi-term中的奇怪字符

[英]Strange characters in ansi-term in emacs

I wrote a c++ program and when I compiled it using g++ in ansi-term, I got some strange characters displayed: 我编写了一个c ++程序,当我在ansi-term中使用g ++编译它时,我显示了一些奇怪的字符:

在此输入图像描述

If required, the error was that i hadn't declared the variable n. 如果需要,错误是我没有声明变量n。 How can I correct this? 我怎么能纠正这个?

Ah! 啊! Tested this... 经过测试......

 (setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

and problem solved!!! 问题解决了!

Looks like the gcc output contains UTF-8 "smart quotes" and your terminal is not set up to display UTF-8. 看起来gcc输出包含UTF-8“智能引号”,并且您的终端未设置为显示UTF-8。 The simple workaround is to use a locale which does not support smart quotes inside Emacs, which should force gcc to fall back to plain-jane ASCII quotes; 简单的解决方法是使用不支持Emacs内部智能引号的locale ,这应该强制gcc回退到简单的ASCII引号; a more sophisticated fix would be to fix the terminal mode in the Ansi-Term buffer to display these correctly. 更复杂的修复方法是修复Ansi-Term缓冲区中的终端模式以正确显示这些模式。

Those are most likely color escape sequences. 那些很可能是颜色转义序列。 emacs has a mode for that which you can enable with the ansi-color-for-comint-mode-on function. emacs有一个模式,你可以使用ansi-color-for-comint-mode-on函数ansi-color-for-comint-mode-on

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM