4

I have

$ 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

But man gives the error:

$ man
man: can't set the locale; make sure $LC_* and $LANG are correct
What manual page do you want?

If I set the LC_ALL, the error disappears:

$ LC_ALL=en_GB.UTF-8 man
What manual page do you want?

But I don't want to set LC_ALL because I set some LC_ to the other locale.

How to solve this problem with man?

3
  • Try setting your locales to "ru_RU.utf8" not "ru_RU.UTF-8".
    – sparticvs
    Commented Nov 3, 2012 at 14:37
  • LC_ALL=ru_RU.UTF-8 man cause no error. Thus, IMHO, man just considers not all LC_ are set. Maybe it need LC_ALL mandatory is set, but this is stupid behavior, I think...
    – user14284
    Commented Nov 3, 2012 at 14:49
  • Negative, LC_ALL is not required, see unix.stackexchange.com/questions/15291/… I looked at my locale settings and everything but LC_ALL is set for me. Mine are all set to "en_US.utf8"
    – sparticvs
    Commented Nov 3, 2012 at 18:20

1 Answer 1

2

I found this code in the source to man for 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);

Try setting the environment variable MAN_NO_LOCALE_WARNING to 1 to see if that helps. I'm not sure why setlocale (LC_ALL, "") is failing, according to the documentation for setlocale():

The return value is NULL if the request cannot be honored.

You must log in to answer this question.