emacs中的Shell通过在它们前面显示变量的名称\200\230

标签 shell emacs

当我从 emacs 中的 shell/eshell/term 运行编译指令时,变量的名称在 shell 中显得很奇怪。

这是一个示例代码(有一些随机错误)和我编译时的输出:

#include iostream
#include cstdlib


int main (void)
{
cscdsd ;//some random error 
return ;
}
//shell o/p:
g++ new.cc 
new.cc: In function â\200\230int main()â\200\231:
new.cc:7: error: â\200\230cscdsdâ\200\231 was not declared in this scope
new.cc:8: error: return-statement with no value, in function returning â\200\230intâ\200\231
~/codes $ 

我发现\200\230 和\200\231 表示变量或函数名的开始和结束。 有什么想法会发生什么或如何摆脱它?

最佳答案

\200是一个八进制转义序列。以十六进制表示,â\200\230E2 80 98 ,这就是 U+2018(左单引号)以 UTF-8 编码的方式。同样,â\200\231是 U+2019(右单引号)。这就是 g++ 时发生的情况。发出 UTF-8,Emacs 将其解释为 ISO-8859-1。

您可能需要设置 default-process-coding-system为不同的值。尝试(在你的 ~/.emacs 中):

(setq default-process-coding-system '(utf-8-unix . utf-8-unix))

还有其他方法可以告诉 Emacs 期望什么样的编码系统。阅读变量的文档 default-process-coding-system & process-coding-system-alist和函数universal-coding-system-argument & set-buffer-process-coding-system .

关于emacs中的Shell通过在它们前面显示变量的名称\200\230,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10374200/

相关文章:

shell - 从 shell 启动时在 shell 中启动 Emacs

linux - Bash:无效的命令

linux - 我有一个日志文件,我需要在其中获取指定的输出,并且需要在 shell 脚本中编写逻辑

Linux shell :Is it possible to speedup finding files using "find" by using a predefined list of files/folders?

templates - 如何使用 Emacs+AUCTeX 创建(自动插入)LaTeX 模板?

javascript - 在 emacs 中 Rails 的 *.js.erb 是否有任何模式,或者我必须使用 TextMate?

eclipse - 如何突出显示 Eclipse 的 Emacs 键绑定(bind)中的选择?

linux - Haskell可以用来写shell脚本吗?

linux - 使用另一个 bash 脚本暴力破解 bash 脚本

arrays - Emacs 和 LaTeX : amount of columns for tables/matrices/arrays