|LOCALE(1)||General Commands Manual||LOCALE(1)|
locale — character
encoding and localization conventions
locale utility is invoked without
any arguments, the current locale configuration is shown.
The options are as follows:
A locale is a set of environment variables telling programs which character encoding, language and cultural conventions the user prefers. Programs in the OpenBSD base system ignore the locale except for the character encoding, and it is not recommended to use any of these variables except that the following non-default setting is supported as an option:
Programs installed from packages(7) may or may not change behavior according to the locale. Many programs use the X/Open System Interfaces naming scheme for the contents of the variables listed below, which is language[_TERRITORY][.encoding][@modifier]
The behavior of some library functions may also depend on the locale, and it does on most other operating systems. The OpenBSD C library tends to avoid locale-dependent behavior except with respect to character encoding. See the manual pages of individual functions for details.
The character encoding locale
instructs programs which character encoding to assume for text input and to
use for text output. A character encoding maps each character of a given
character set to a byte sequence suitable for storing or transmitting the
The OpenBSD base system supports two
locales: the default of
LC_CTYPE=C selects the
US-ASCII character set and encoding, treating the bytes 0x80 to 0xff as
non-printable characters of application-specific meaning.
LC_CTYPE=POSIX is an alias for
LC_CTYPE=C. The alternative of
LC_CTYPE=en_US.UTF-8 selects the UTF-8 encoding of
the Unicode character set, which is supported by many parts of the system,
but not yet fully supported by all parts.
If the value of
LC_CTYPE ends in
.UTF-8’, programs in the
OpenBSD base system ignore the beginning of it,
treating for example zh_CN.UTF-8 exactly like en_US.UTF-8. Programs from
packages(7) may however make a
difference. If the value of
LC_CTYPE is unsupported,
programs and libraries in the OpenBSD base systems
fall back to
Some programs, for example write(1), deliberately ignore the locale and always use US-ASCII only. See the manual pages of individual programs for details.
The locale configuration consists of the following environment variables:
LC_MESSAGEScatalogs in GNU gettext format.
LC_MESSAGEScatalogs in catopen(3) format.
locale utility exits 0 on
success, and >0 if an error occurs.
Related ports: converters/libiconv, devel/gettext, textproc/icu4c
With respect to locale support, most libraries and programs in the
OpenBSD base system, including the
locale utility, implement a subset of the
IEEE Std 1003.1-2008 (“POSIX.1”)
locale utility was first standardized
in the X/Open Portability Guide Issue 4
It was rewritten from scratch for OpenBSD 5.4 during the 2013 Toronto hackathon.
Stefan Sperling <firstname.lastname@example.org> with contributions from Philip Guenther <email@example.com> and Jeremie Courreges-Anglas <firstname.lastname@example.org>. This manual page was written by Ingo Schwarze <email@example.com>.
locale concept is inadequate for
inter-process communication. Two processes exchanging text, for example over
a network, using sockets, in shared memory, or even using plain text files
always need a protocol-specific way to negotiate the character encoding
The list of supported locales is perpetually incomplete.
|April 17, 2020||OpenBSD-current|