|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
<HTML>
|
|
Packit Service |
50ad14 |
<HEAD>
|
|
Packit Service |
50ad14 |
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
Packit Service |
50ad14 |
<TITLE>The Linux keyboard and console HOWTO: How to make other programs work with non-ASCII chars</TITLE>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ-13.html" REL=next>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ-11.html" REL=previous>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ.html#toc12" REL=contents>
|
|
Packit Service |
50ad14 |
</HEAD>
|
|
Packit Service |
50ad14 |
<BODY>
|
|
Packit Service |
50ad14 |
Next
|
|
Packit Service |
50ad14 |
Previous
|
|
Packit Service |
50ad14 |
Contents
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
non-ASCII characters, using
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
In the bad old days this used to be quite a hassle. Every separate
|
|
Packit Service |
50ad14 |
program had to be convinced individually to leave your bits alone.
|
|
Packit Service |
50ad14 |
Not that all is easy now, but recently a lot of gnu utilities have
|
|
Packit Service |
50ad14 |
learned to react to LC_CTYPE=iso_8859_1 or LC_CTYPE=iso-8859-1 .
|
|
Packit Service |
50ad14 |
Try this first, and if it doesn't help look at the hints below.
|
|
Packit Service |
50ad14 |
Note that in recent versions of libc the routine setlocale() only
|
|
Packit Service |
50ad14 |
works if you have installed the locale files (e.g. in
|
|
Packit Service |
50ad14 |
/usr/lib/locale ).
|
|
Packit Service |
50ad14 |
NOTE! The above was written years ago. Today locale stuff is a bit different.
|
|
Packit Service |
50ad14 |
Try the command locale -a to see which locales are available.
|
|
Packit Service |
50ad14 |
Then use one of these locale names instead of the iso_8859-1
|
|
Packit Service |
50ad14 |
mentioned above. For example, LC_CTYPE=fr_FR.ISO-8859-1 or
|
|
Packit Service |
50ad14 |
LC_CTYPE=fr_FR@euro .
|
|
Packit Service |
50ad14 |
NOTE! Some of the below may still be true. Most of it is outdated.
|
|
Packit Service |
50ad14 |
(Please report on what is incorrect today, so that it can be deleted.)
|
|
Packit Service |
50ad14 |
First of all, the 8-th bit should survive the kernel input processing,
|
|
Packit Service |
50ad14 |
so make sure to have stty cs8 -istrip -parenb set.
|
|
Packit Service |
50ad14 |
A. For emacs the details strongly depend on the version.
|
|
Packit Service |
50ad14 |
The information below is for version 19.34. Put lines
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(set-input-mode nil nil 1)
|
|
Packit Service |
50ad14 |
(standard-display-european t)
|
|
Packit Service |
50ad14 |
(require 'iso-syntax)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
into your $HOME/.emacs .
|
|
Packit Service |
50ad14 |
The first line (to be precise: the final 1)
|
|
Packit Service |
50ad14 |
tells emacs not to discard the 8-th bit from input characters.
|
|
Packit Service |
50ad14 |
The second line tells emacs not to display non-ASCII characters
|
|
Packit Service |
50ad14 |
as octal escapes.
|
|
Packit Service |
50ad14 |
The third line specifies the syntactic properties
|
|
Packit Service |
50ad14 |
and case conversion table for the Latin-1 character set
|
|
Packit Service |
50ad14 |
These last two lines are superfluous if you have something like
|
|
Packit Service |
50ad14 |
LC_CTYPE=ISO-8859-1 in your environment.
|
|
Packit Service |
50ad14 |
(The variable may also be LC_ALL or even LANG .
|
|
Packit Service |
50ad14 |
The value may be anything with a substring `88591' or `8859-1'
|
|
Packit Service |
50ad14 |
or `8859_1'.)
|
|
Packit Service |
50ad14 |
This is a good start.
|
|
Packit Service |
50ad14 |
On a terminal that cannot display non-ASCII ISO 8859-1 symbols,
|
|
Packit Service |
50ad14 |
the command
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(load-library "iso-ascii")
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
will cause accented characters to be displayed comme {,c}a.
|
|
Packit Service |
50ad14 |
If your keymap does not make it easy to produce non-ASCII characters,
|
|
Packit Service |
50ad14 |
then
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(load-library "iso-transl")
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
will make the 2-character sequence Ctrl-X 8 a compose character,
|
|
Packit Service |
50ad14 |
so that the 4-character sequence Ctrl-X 8 , c produces c-cedilla.
|
|
Packit Service |
50ad14 |
Very inconvenient.
|
|
Packit Service |
50ad14 |
The command
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(iso-accents-mode)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
will toggle ISO-8859-1 accent mode, in which the six
|
|
Packit Service |
50ad14 |
characters ', `, ", ^, ~, / are dead keys
|
|
Packit Service |
50ad14 |
modifying the following symbol.
|
|
Packit Service |
50ad14 |
Special combinations: ~c gives a c with cedilla,
|
|
Packit Service |
50ad14 |
~d gives an Icelandic eth, ~t gives an Icelandic thorn,
|
|
Packit Service |
50ad14 |
"s gives German sharp s, /a gives a with ring,
|
|
Packit Service |
50ad14 |
/e gives an a-e ligature, ~< and ~> give guillemots,
|
|
Packit Service |
50ad14 |
~! gives an inverted exclamation mark,
|
|
Packit Service |
50ad14 |
~? gives an inverted question mark, and '' gives an acute accent.
|
|
Packit Service |
50ad14 |
This is the default mapping of accents.
|
|
Packit Service |
50ad14 |
The variable iso-languages is a list of pairs (language name,
|
|
Packit Service |
50ad14 |
accent mapping), and a non-default mapping can be selected using
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(iso-accents-customize LANGUAGE)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Here LANGUAGE can be one of "portuguese" , "irish" ,
|
|
Packit Service |
50ad14 |
"french" , "latin-2" , "latin-1" .
|
|
Packit Service |
50ad14 |
Since the Linux default compose character is Ctrl-.
|
|
Packit Service |
50ad14 |
it might be convenient to use that everywhere. Try
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(load-library "iso-insert.el")
|
|
Packit Service |
50ad14 |
(define-key global-map [?\C-.] 8859-1-map)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
The latter line will not work under xterm , if you use emacs -nw ,
|
|
Packit Service |
50ad14 |
but in that case you can put
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
XTerm*VT100.Translations: #override\n\
|
|
Packit Service |
50ad14 |
Ctrl <KeyPress> . : string("\0308")
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in your .Xresources .)
|
|
Packit Service |
50ad14 |
B. For less , put LESSCHARSET=latin1 in the environment.
|
|
Packit Service |
50ad14 |
This is also what you need if you see \255 or <AD>
|
|
Packit Service |
50ad14 |
in man output: some versions of less will render the soft hyphen
|
|
Packit Service |
50ad14 |
(octal 0255, hex 0xAD) this way when not given permission to output Latin-1.
|
|
Packit Service |
50ad14 |
C. For ls , give the option -N . (Probably you want to make an alias.)
|
|
Packit Service |
50ad14 |
D. For bash (version 1.13.*), put
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
set meta-flag on
|
|
Packit Service |
50ad14 |
set convert-meta off
|
|
Packit Service |
50ad14 |
set output-meta on
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
into your $HOME/.inputrc .
|
|
Packit Service |
50ad14 |
E. For tcsh , use
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
setenv LANG en_US
|
|
Packit Service |
50ad14 |
setenv LC_CTYPE iso_8859_1
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
If you have nls on your system, then the corresponding routines are used.
|
|
Packit Service |
50ad14 |
Otherwise tcsh will assume iso_8859_1, regardless of the values given to
|
|
Packit Service |
50ad14 |
LANG and LC_CTYPE. See the section NATIVE LANGUAGE SYSTEM in tcsh(1).
|
|
Packit Service |
50ad14 |
(The Danish HOWTO says: setenv LC_CTYPE ISO-8859-1; stty pass8 )
|
|
Packit Service |
50ad14 |
F. For flex , give the option -8 if the parser it generates must be
|
|
Packit Service |
50ad14 |
able to handle 8-bit input. (Of course it must.)
|
|
Packit Service |
50ad14 |
G. For elm , set displaycharset to ISO-8859-1 .
|
|
Packit Service |
50ad14 |
(Danish HOWTO: LANG=C and LC_CTYPE=ISO-8859-1 )
|
|
Packit Service |
50ad14 |
H. For programs using curses (such as lynx ) David Sibley reports:
|
|
Packit Service |
50ad14 |
The regular curses package uses the high-order bit for reverse video mode
|
|
Packit Service |
50ad14 |
(see flag _STANDOUT defined in /usr/include/curses.h ). However,
|
|
Packit Service |
50ad14 |
ncurses seems to be 8-bit clean and does display iso-latin-8859-1
|
|
Packit Service |
50ad14 |
correctly.
|
|
Packit Service |
50ad14 |
I. For programs using groff (such as man ), make sure to use
|
|
Packit Service |
50ad14 |
-Tlatin1 instead of -Tascii . Old versions of the program man
|
|
Packit Service |
50ad14 |
also use col , and the next point also applies.
|
|
Packit Service |
50ad14 |
K. For rlogin , use option -8 .
|
|
Packit Service |
50ad14 |
L. For joe ,
|
|
Packit Service |
50ad14 |
metalab.unc.edu:/pub/Linux/apps/editors/joe-1.0.8-linux.tar.gz
|
|
Packit Service |
50ad14 |
is said to work after editing the configuration file. Someone else said:
|
|
Packit Service |
50ad14 |
joe : Put the -asis option in /isr/lib/joerc in the
|
|
Packit Service |
50ad14 |
first column.
|
|
Packit Service |
50ad14 |
M. For LaTeX: \documentstyle[isolatin]{article} .
|
|
Packit Service |
50ad14 |
For LaTeX2e: \documentclass{article}\usepackage{isolatin}
|
|
Packit Service |
50ad14 |
where isolatin.sty is available from
|
|
Packit Service |
50ad14 |
ftp.vlsivie.tuwien.ac.at/pub/8bit.
|
|
Packit Service |
50ad14 |
A nice discussion on the topic of ISO-8859-1 and how to manage 8-bit
|
|
Packit Service |
50ad14 |
characters is contained in the file grasp.insa-lyon.fr:/pub/faq/fr/accents
|
|
Packit Service |
50ad14 |
(in French). Another fine discussion (in English) can be found in
|
|
Packit Service |
50ad14 |
rtfm.mit.edu:pub/usenet-by-group/comp.answers/internationalization/iso-8859-1-charset.
|
|
Packit Service |
50ad14 |
If you need to fix a program that behaves badly with 8-bit characters,
|
|
Packit Service |
50ad14 |
one thing to keep in mind is that if you have a signed char type then
|
|
Packit Service |
50ad14 |
characters may be negative, and using them as an array index will fail.
|
|
Packit Service |
50ad14 |
Several programs can be fixed by judiciously adding (unsigned char) casts.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Next
|
|
Packit Service |
50ad14 |
Previous
|
|
Packit Service |
50ad14 |
Contents
|
|
Packit Service |
50ad14 |
</BODY>
|
|
Packit Service |
50ad14 |
</HTML>
|