我有
$ locale
LANG=en_GB.UTF-8
LC_CTYPE=ru_RU.UTF-8
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE=ru_RU.UTF-8
LC_MONETARY=ru_RU.UTF-8
LC_MESSAGES=en_GB.UTF-8
LC_PAPER=ru_RU.UTF-8
LC_NAME=ru_RU.UTF-8
LC_ADDRESS=ru_RU.UTF-8
LC_TELEPHONE=ru_RU.UTF-8
LC_MEASUREMENT=ru_RU.UTF-8
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=
$ locale -a
C
en_GB.utf8
POSIX
ru_RU.utf8
但man
给出了错误:
$ man
man: can't set the locale; make sure $LC_* and $LANG are correct
What manual page do you want?
如果我设置LC_ALL
,错误就会消失:
$ LC_ALL=en_GB.UTF-8 man
What manual page do you want?
但我不想设置,LC_ALL
因为我将一些设置LC_
为其他语言环境。
如何解决这个问题man
?
答案1
man
我在Debian squeeze 的源代码中找到了这段代码:
/* initialise the locale */
if (!setlocale (LC_ALL, "") && !getenv ("MAN_NO_LOCALE_WARNING"))
/* Obviously can't translate this. */
error (0, 0, "can't set the locale; make sure $LC_* and $LANG "
"are correct");
setenv ("MAN_NO_LOCALE_WARNING", "1", 1);
尝试将环境变量设置MAN_NO_LOCALE_WARNING
为 1 看看是否有帮助。setlocale (LC_ALL, "")
根据以下文档,我不确定为什么失败setlocale()
:
The return value is NULL if the request cannot be honored.