Synopsis #
OpenBSD base supports the C/POSIX locale and UTF-8 character handling. It does not provide a full set of translated messages or locale-specific numeric, date, and sorting rules. Keyboard layout and timezone are configured separately. Packaged applications may provide additional internationalization.
Configuring Locales and UTF-8 Support #
Locale Environment Variables #
locale(1)
displays the environment. In base, LC_CTYPE controls character encoding; other locale categories are not implemented. LC_ALL overrides category-specific settings and LANG supplies the default.
locale
export LC_CTYPE=en_US.UTF-8
A name such as de_DE.UTF-8 selects UTF-8 handling; it does not make base messages German or change the date format.
Available Locales #
locale -a
Consult the installed locale(1) and setlocale(3) manuals. OpenBSD does not require generating or installing a collection of compiled regional locales.
Using UTF-8 in the Console #
Use a terminal and font that can display the needed characters. An encoding setting cannot add missing font glyphs, and individual utilities differ in multibyte support. An SSH connection uses the display capabilities of the client terminal. Console font and keyboard support depend on the hardware and console driver.
Persistent Locale Configuration #
Example: .profile (for sh, ksh, etc.)
#
export LC_CTYPE=en_US.UTF-8
Example: /etc/login.conf
#
Set the setenv capability in the user’s existing login class, preserving the file’s continuation syntax:
:setenv=LC_CTYPE=en_US.UTF-8:
Merge this into any existing setenv list. This sets LC_CTYPE. After editing, rebuild the database and log in again:
doas cap_mkdb /etc/login.conf
See login.conf(5) .
Timezone Configuration #
The system timezone is selected through /etc/localtime, normally a link to a file under /usr/share/zoneinfo. A user’s TZ environment variable can override the timezone for that user’s processes.
Installer Timezone Selection #
The installer asks for a timezone. To change it after installation, update /etc/localtime as shown below.
Setting Timezone Manually #
For example:
doas ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
date
Long-running applications may cache timezone information and need restarting. A system reboot is not normally required.
Checking the Current Timezone #
readlink /etc/localtime
date
Coordinated UTC and RTC Handling #
Prefer a hardware clock set to UTC. The kern.utc_offset control supports hardware clocks using local time; it is not the timezone setting or a display of the current UTC time.
sysctl kern.utc_offset
date -u
Use ntpd(8)
to synchronize system time. OpenBSD does not provide the Linux hwclock command.
Console Keyboard Layouts #
wsconsctl(8) configures supported wscons console keyboards. X11 uses its own keyboard configuration.
Listing Available Keymaps #
Consult kbd(8)
for layout names. There is no /usr/share/wscons/keymaps/ directory of layout files to install.
Setting the Keymap Temporarily #
doas wsconsctl keyboard.encoding=de.nodead
doas wsconsctl keyboard.encoding
Persistent Keyboard Configuration #
Add the setting to /etc/wsconsctl.conf:
keyboard.encoding=de.nodead
Apply it now with wsconsctl as above. The boot scripts read the configuration at startup; there is no rc.d/wsconsctl service to restart.