Thursday, November 21, 2024

command line – Unknown locale, assuming C – Error message in terminal

Note: The question is not about how to change the locale, or what is the locale. The question is about why is there a locale-based error in man in 10.3, but no error in 12.6, even though the locales are identical in both cases.


After running man, reading a manual entry and closing it, I receive the following error

$ man curl                     # The manual opens, I read it, then close
Unknown locale, assuming C
$ man zsh                      # The manual opens, I read it, then close
Unknown locale, assuming C

The manual pages work correctly, and can be browsed, but I have no idea where the error comes from, and it is rather annoying.

This is what I obtain when running locale

$ locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

I’m using Ventura 13.0. The same error does not happen in 12.6 even though the locale is identical (see below), so I do not think that it is an issue with locale, but rather an issue with man.

Note that locale says

   LANG         Used as a substitute for any unset LC_* variable.   \  
If LANG is unset, it will act as if set to "C".  If any of LANG or  \  
LC_* are set to invalid values, locale acts as if they are all unset.

so there should be no error, LANG should be automatically set to C.

EDIT:

Some new insight. I ran the same commands on two computers.

Computer 1 runs 13.0 outputs the error.
This computer has man for MacOS 13.0 from January 9 2021.

Computer 2 runs 12.6 and outputs no error.
This computer has man version 1.6g from September 19 2005.

The output of the locale command is completely identical on both computers, in particular they both have LC_CTYPE="UTF-8".

Could it be a man bug?

Related Articles

Latest Articles