View Single Post
  #1   (View Single Post)  
Old 25th February 2009
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Default HOWTO: ISO-8859-1 Character Set on NetBSD

Many of us may at one time or another need to use more characters than are in standard 7-bit ASCII. But, we need not necessarily need to go to the much more heavyweight, full-blown unicode. Most of us don't need to print Asian characters, or Hebrew, Sanskrit, etc. For most of us, who communicate in languages of Western European origin, we need only the extended ASCII set. This provides characters with accents and such. Even those who only speak the English language may occasionally have use of these characters, for instance in the proper spelling of cliché and fiancé.

Enter ISO-8859-1. This character set is the 8-bit ASCII character set, also sometimes called Latin1 or Latin-Extended-A. The bad news is that this isn't enabled by default. The good news is that it is very easy to turn on and most applications as of NetBSD 5.0_RC2 support these characters by default.

To enable it with (T)CSH in NetBSD, put this in your .(t)cshrc:

Code:
setenv LANG en_US.ISO8859-1
setenv LC_CTYPE en_US.ISO8859-1
If you use the Bourne shell, then put this in your .profile file:

Code:
export LANG en_US.ISO8859-1
export LC_CTYPE en_US.ISO8859-1
For other systems, you can find the proper character set name by using the locale -a command.


After this, most console apps will automatically recognize the extended characters, used by pressing [ALT]+key (nvi supports this with 1.81).

But the question you may be asking is -- how do I know what character is at what key? If you need to add an é to a word, you could randomly search the keyboard in a frenzy -- wasting time. Or, if you use it enough, you may eventually memorize a character here and there. But here is a table that shows what characters are mapped to which keys on a standard US keyboard (table is divided into rows on the keyboard).

Note: a couple characters didn't display right in this forum, so I had to write out what they are.

Code:
KEY		SHIFT+KEY		ALT+KEY	          ALT+SHIFT+KEY


 `		    ~		      <a w/acute>		þ
 1		    !			   ±			¡
 2 		    @			   ²			À
 3		    #			   ³			£
 4		    $			   ´			¤
 5		    %			   µ			¥
 6		    ^			   ¶			Þ
 7		    &			   ·			¦
 8		    *			   ¸			ª
 9		    (			   ¹			¨
 0		    )			   °			©
 -		    _		     <soft hyphen>		ß
 =		    +			   ½			«


 q		    Q			   ñ			Ñ
 w		    W			   ÷			×
 e		    E			   å			Å
 r		    R			   ò			Ò
 t		    T			   ô			Ô
 y		    Y			   ù			Ù
 u		    U			   õ			Õ
 i		    I			   é			É
 o		    O			   ï			Ï
 p		    P			   ð			Ð
 [		    {			   Û			û
 ]		    }			   Ý			ý
 \		    |			   Ü			ü


 a		    A			   á			Á
 s		    S			   ó			Ó
 d		    D			   ä			Ä
 f		    F			   æ			Æ
 g		    G			   ç			Ç
 h		    H			   è			È
 j		    J			   ê			Ê
 k		    K			   ë			Ë
 l		    L			   ì			Ì
 ;		    :			   »			º
 '		    "			   §			¢


 z		    Z			   ú			Ú
 x		    X			   ø			Ø
 c		    C			   ã			Ã
 v		    V			   ö			Ö
 b		    B			   â			Â
 n		    N			   î			Î
 m		    M		      <i w/acute>		Í
 ,		    <			   ¬			¼
 .		    >			   ®			¾
 /		    ?			   ¯			¿

Now, you just need to quickly look up in this table what character you need to be able to write it from the keyboard in your favorite application.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote