set up a Debian Linux machine to handle UTF-8 in a shell or console app

To set up a Debian Linux machine to handle UTF-8 in a shell or console app do the following.

First, use dselect or whatever tool you like to find the Japanese font packages for X and install em.

Then run

  dpkg-reconfigure locales

then choose en_US.UTF-8

Test by executing the folowing in a shell:

  locale charmap

it should say

UTF-8

If not try just

  locale

it should have UTF-8 for everything like:

LANG=en_US.UTF-8
LANGUAGE=en_US:en_GB:en
LC_CTYPE=”en_US.UTF-8″
LC_NUMERIC=”en_US.UTF-8″
LC_TIME=”en_US.UTF-8″
LC_COLLATE=”en_US.UTF-8″
LC_MONETARY=”en_US.UTF-8″
LC_MESSAGES=”en_US.UTF-8″
LC_PAPER=”en_US.UTF-8″
LC_NAME=”en_US.UTF-8″
LC_ADDRESS=”en_US.UTF-8″
LC_TELEPHONE=”en_US.UTF-8″
LC_MEASUREMENT=”en_US.UTF-8″
LC_IDENTIFICATION=”en_US.UTF-8″
LC_ALL=en_US.UTF-8

if not then Add the follwoing to .bashrc and re-source it (e.g. get a new login shell, or execute bash)

  export LC_ALL="en_US.UTF-8"

then try

locale charmap

or

 locale

once that is all set to UTF-8 then change your shells (xterm, rxvt) to use:
uxterm
urxvt

That is it. I had to exit X11 and re-login to get X11 to take these settings
so that clicking my icon for xterm launched uxterm WITH the correct environment

After this all console apps that can handle UTF-8 (like vim) display UTF-8
characters correctly.

Advertisements

About Jayson
Father, mountain biker, Software developer at a wire service, and also work with the IPTC (iptc.org)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: