Table of Contents

UTF-8 in Bash

Bash has no problems with UTF-8 support. That is, as long as Bash knows you want UTF-8. To get it set up on a Debian box you need to edit 2 files and execute 1 script.

edit /etc/locale.gen and remove the “hash” in front of the UTF-8 language of your choice (ie. English = en_US UTF-8, German = de_DE UTF-8). Activating multiple Languages is allowed. Once you are done save the changes and execute the following:

ROOT
root@some-system:~# locale-gen Generating locales (this might take a while)… .de_DE.UTF-8… done .en_US.UTF-8… done Generation complete. root@some-system:~#_

This generates the correct locales for your system according to your selections.

The last step is to modify your ~/.bashrc. Once you are happy with the settings you can add the changes to the system skel so all new users have the same support.

export LANG=en_US.UTF-8
export LESSCHARSET=utf-8
export PERL_UTF8_LOCALE=1 PERL_UNICODE=AS

After saving the changes just exit your shell and log back in to have the changes.

Enjoy.

/var/customers/webs/cw01/wiki/data/pages/debian/utf8andbash.txt · Last modified: 2012/07/11 15:06 by wadmin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki