Jan 29, 2015

Globally Enable UTF-8 (Unicode) on FreeBSD


One nice thing about FreeBSD is that it doesn't make many assumptions. This of course can lead to a bit of elbow grease being required, but at least the end result is an OS tailored to the need. One such instance is the lack of a set locale. A Google search produces quite a few results for setting locale on a per user basis, but setting locale globally is covered a little less.

First verify that locale is not set with:

$ locale


If no result is returned locale is not set. In order to set it /etc/login.conf must be modified as root. Open the file using your preferred editor and add the following lines:

:charset=UTF-8:\
:lang=en_US.UTF-8:


It is then necessary to update the system using:

# cap_mkdb /etc/login.conf
Logout and log back in. You should now see en_US.UTF-8 as follows:

$ locale
LANG=en_US.UTF-8
...

No comments: