我正在使用 PuTTY 和 gcc 访问 Ubuntu 机器。

默认 LANG 本机上的环境变量设置为 en_NZ.UTF-8, ,这会导致 GCC 认为 PuTTY 能够显示 UTF-8 文本,但事实似乎并非如此。也许这是我的字体,我不知道 - 它是这样的:

foo.c:1: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â at end of input

如果我设置它 export LANG=en_NZ, ,那么这会导致 GCC 正常运行,我得到:

foo.c:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input

但这会导致其他一切都出错。例如

man foo
man: can't set the locale; make sure $LC_* and $LANG are correct

我在 Google 上搜索过,但我怎么也找不到我必须在其中输入什么才能让它只使用 ASCII。 en_NZ.ASCII 不起作用,我能找到的任何其他东西也不起作用。

谢谢

有帮助吗?

解决方案

LANG=en_NZ 是正确的。但是,您必须为以下内容创建语言环境文件 en_NZ.

对于 Ubuntu,编辑 /var/lib/locales/supported.d/local 并添加 en_NZ ISO-8859-1 到文件。如果您的系统是其他发行版(包括 Debian),则位置会有所不同。看着 /usr/sbin/locale-gen 并查看它存储此信息的位置。

之后,运行 locale-gen 来创建 en_NZ 区域设置文件。希望这可以帮助!

其他提示

Putty可以显示utf - 我认为它是外观->翻译(或者其他东西,我现在无法访问它)。

对于 Debian 5.0 莱尼:

aptitude install locales

如果已经安装:

dpkg-reconfigure locales
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top