In the bad old days this used to be quite a hassle. Every separate program had to be convinced individually to leave your bits alone. Not that all is easy now, but recently a lot of gnu utilities have learned to react to LC_CTYPE=iso_8859_1 or LC_CTYPE=iso-8859-1. Try this first, and if it doesn't help look at the hints below. Note that in recent versions of libc the routine setlocale() only works if you have installed the locale files (e.g. in /usr/lib/locale).
LC_CTYPE=iso_8859_1
LC_CTYPE=iso-8859-1
/usr/lib/locale
NOTE! The above was written years ago. Today locale stuff is a bit different. Try the command locale -a to see which locales are available. Then use one of these locale names instead of the iso_8859-1 mentioned above. For example, LC_CTYPE=fr_FR.ISO-8859-1 or LC_CTYPE=fr_FR@euro.
locale -a
iso_8859-1
LC_CTYPE=fr_FR.ISO-8859-1
LC_CTYPE=fr_FR@euro
NOTE! Some of the below may still be true. Most of it is outdated. (Please report on what is incorrect today, so that it can be deleted.)
First of all, the 8-th bit should survive the kernel input processing, so make sure to have stty cs8 -istrip -parenb set.
stty cs8 -istrip -parenb
A. For emacs the details strongly depend on the version. The information below is for version 19.34. Put lines
emacs
(set-input-mode nil nil 1) (standard-display-european t) (require 'iso-syntax)
$HOME/.emacs
LC_CTYPE=ISO-8859-1
LC_ALL
LANG
This is a good start. On a terminal that cannot display non-ASCII ISO 8859-1 symbols, the command
(load-library "iso-ascii")
(load-library "iso-transl")
The command
(iso-accents-mode)
iso-languages
(iso-accents-customize LANGUAGE)
"portuguese"
"irish"
"french"
"latin-2"
"latin-1"
Since the Linux default compose character is Ctrl-. it might be convenient to use that everywhere. Try
(load-library "iso-insert.el") (define-key global-map [?\C-.] 8859-1-map)
xterm
emacs -nw
XTerm*VT100.Translations: #override\n\ Ctrl <KeyPress> . : string("\0308")
.Xresources
B. For less, put LESSCHARSET=latin1 in the environment. This is also what you need if you see \255 or <AD> in man output: some versions of less will render the soft hyphen (octal 0255, hex 0xAD) this way when not given permission to output Latin-1.
less
LESSCHARSET=latin1
\255
<AD>
man
C. For ls, give the option -N. (Probably you want to make an alias.)
ls
-N
D. For bash (version 1.13.*), put
bash
set meta-flag on set convert-meta off set output-meta on
$HOME/.inputrc
E. For tcsh, use
tcsh
setenv LANG en_US setenv LC_CTYPE iso_8859_1
setenv LC_CTYPE ISO-8859-1; stty pass8
F. For flex, give the option -8 if the parser it generates must be able to handle 8-bit input. (Of course it must.)
flex
-8
G. For elm, set displaycharset to ISO-8859-1. (Danish HOWTO: LANG=C and LC_CTYPE=ISO-8859-1)
elm
displaycharset
ISO-8859-1
LANG=C
H. For programs using curses (such as lynx) David Sibley reports: The regular curses package uses the high-order bit for reverse video mode (see flag _STANDOUT defined in /usr/include/curses.h). However, ncurses seems to be 8-bit clean and does display iso-latin-8859-1 correctly.
lynx
/usr/include/curses.h
ncurses
I. For programs using groff (such as man), make sure to use -Tlatin1 instead of -Tascii. Old versions of the program man also use col, and the next point also applies.
groff
-Tlatin1
-Tascii
col
K. For rlogin, use option -8.
rlogin
L. For joe, metalab.unc.edu:/pub/Linux/apps/editors/joe-1.0.8-linux.tar.gz is said to work after editing the configuration file. Someone else said: joe: Put the -asis option in /isr/lib/joerc in the first column.
joe
metalab.unc.edu:/pub/Linux/apps/editors/joe-1.0.8-linux.tar.gz
-asis
/isr/lib/joerc
M. For LaTeX: \documentstyle[isolatin]{article}. For LaTeX2e: \documentclass{article}\usepackage{isolatin} where isolatin.sty is available from ftp.vlsivie.tuwien.ac.at/pub/8bit.
\documentstyle[isolatin]{article}
\documentclass{article}\usepackage{isolatin}
isolatin.sty
A nice discussion on the topic of ISO-8859-1 and how to manage 8-bit characters is contained in the file grasp.insa-lyon.fr:/pub/faq/fr/accents (in French). Another fine discussion (in English) can be found in rtfm.mit.edu:pub/usenet-by-group/comp.answers/internationalization/iso-8859-1-charset.
grasp.insa-lyon.fr:/pub/faq/fr/accents
If you need to fix a program that behaves badly with 8-bit characters, one thing to keep in mind is that if you have a signed char type then characters may be negative, and using them as an array index will fail. Several programs can be fixed by judiciously adding (unsigned char) casts.