emacs中的Shell通过在变量前面加上它们来显示变量名\200\230
当我在emacs中从shell/eshell/term运行编译指令时,变量的名称在shell中显得很奇怪 下面是一个示例代码(带有一些随机错误)和编译时的输出:emacs中的Shell通过在变量前面加上它们来显示变量名\200\230,shell,emacs,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:
#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\230
是E2 80 98
,这就是U+2018(左单引号)在UTF-8中的编码方式。同样地,–200\231
是U+2019(右单引号)。这就是当g++
发出UTF-8并且Emacs将其解释为ISO-8859-1时发生的情况
您可能需要将默认过程编码系统
设置为不同的值。尝试(在~/.emacs中):
还有其他方法可以告诉Emacs预期的编码系统。阅读变量
默认过程编码系统
&过程编码系统列表
和函数通用编码系统参数
&设置缓冲区过程编码系统
文本编码应是环境变量的一部分。export LANG=en_US.UTF-8应该修复。
在Ubuntu系统上,在/etc/default/locale
中更改它
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))