How to use wide-range characters a.k.a. UTF-8 in NetBSD.

Just to show off. That's how UTF-8 encoded spam will look like ;-)

Just to show off. That's how UTF-8 encoded spam will look like ;-)

Contents

  1. Introduction
  2. Note on wscons
  3. Note on uwscons
  4. pkgsrc
  5. Soup up a shell
    1. ksh
    2. mksh
    3. zsh
    4. tcsh
    5. bash
    6. Shell environment
  6. X Terminal emulators
    1. xterm
    2. gnome-terminal
    3. urxvt
    4. uxterm
    5. aterm
    6. Eterm
  7. Utilities
    1. less
    2. screen
    3. lynx
    4. irssi
    5. silc-client
    6. vi
    7. nvi
    8. vim
    9. emacs
    10. mutt
  8. Servers
    1. Apache2
  9. Converting files
  10. Filesystems

Introduction

This is all about Unicode on NetBSD.

Note on wscons

wscons doesn't support UTF-8, you'll need X11 and a proper X terminal emulator for this to be of any use, or you get character mash for lunch! Only the [ASCII][40] part of Unicode, namely the first 128 characters, will work in your wscons console, as they overlap in both UTF-8 and ISO-8859 character sets:

   [40]: http://de.wikipedia.org/wiki/ASCII-Tabelle (http://de.wikipedia.org/wiki/ASCII-Tabelle)

!"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_ `abcdefghijklmnopqrstuvwxyz{|}~

Note on uwscons

Unofficial patches for 3.0 release can be found here: ftp://tink.ims.ac.jp/pub/NetBSD/uwscons/

pkgsrc

Soup up a shell

ksh

mksh

zsh

tcsh

bash

Shell environment

or if you have a C-style shell

   setenv LANG "en_US.UTF-8"
   setenv LC_CTYPE "en_US.UTF-8"
   setenv LC_ALL ""

The other locale variables should be left untouched, which is "C" by default, to not confuse programs. Other locales than en_US probably won't work too well, since the fonts aren't in the base system yet, but you can install them and try your luck, of course.

The result should look like

   % locale
   LANG="en_US.UTF-8"
   LC_CTYPE="en_US.UTF-8"
   LC_COLLATE="C"
   LC_TIME="C"
   LC_NUMERIC="C"
   LC_MONETARY="C"
   LC_MESSAGES="en_US.UTF-8"
   LC_ALL=""

X Terminal emulators

xterm

gnome-terminal

urxvt

uxterm

aterm

Eterm

Utilities

less

screen

lynx

Or change "Display character set" in the options menu.

irssi

   /set recode_autodetect_utf8 yes
   /set recode_fallback iso-8859-1  (or whatever seems fit)
   /set recode_out_default_charset UTF-8          
   /set term_charset UTF-8           
   /save        

silc-client

   /set term_type utf-8
   /save

and restart.

vi

nvi

(XXX)

vim

emacs

This one gives you umlauts:

   ; === Make ä, ö, ü, ß work ===
   (set-language-environment 'german)

mutt

If you haven't set it in PKG_DEFAULT_OPTIONS already, you may also add to mk.conf

  PKG_OPTIONS.mutt+= ncursesw

Servers

Apache2

Converting files

Filesystems

Add a comment