how can i use ISO-8859-1??
Giorgos Keramidas
keramida at ceid.upatras.gr
Tue Sep 9 05:26:39 UTC 2008
On Mon, 8 Sep 2008 21:35:07 -0700, Gary Kline <kline at thought.org> wrote:
> Guys,
>
> This is one of the I've-been-meaning-to-ask questions; but other
> things keep happening that took precedence. Now it's time to ask what
> are the voodoo commands to set up in my ~/.zshrc or other initiation
> files (probably including my muttrc) that will let me print to stdout,
> characters like the "e-aigu" or "u-umlaut" and the currency pound or
> Euro?
>
> I keep running into '\240' characters that are likely M$ format
> commands. [...]
That's not really an ISO 8859-1 problem, but a locale setup issue.
In my .bashrc file I have the following:
# Locale setup.
export LANG="C"
export LC_CTYPE="el_GR.ISO8859-7"
export LC_COLLATE="el_GR.ISO8859-7"
unset LC_ALL LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
You can use something similar to set things up for `en_US.ISO8859-1':
# Locale setup.
export LANG="C"
export LC_CTYPE="en_US.ISO8859-1"
export LC_COLLATE="en_US.ISO8859-1"
unset LC_ALL LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
If you want _everything_ to be displayed using the standard en_US
conventions for en_US.ISO8859-1, you can alternatively use:
export LANG="C"
export LC_ALL="en_US.ISO8859-1"
unset LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
and let LC_ALL override everything.
A slightly better idea (which doesn't hardcode LANG and LC_ALL for all
shell instances) is to configure your personal `.login_conf' file with
something like:
me:\
:charset=iso-8859-1:\
:lang=en_US.ISO8859-1:\
:setenv=LC_ALL=en_US.ISO8859-1:
With this in place you will get the 'correct' environment regardless of
the login shell you are using: bash, csh or zsh.
Note: By avoiding hardcoded locale setup in your shell startup file
you can even spawn sub-shells with different locales. Here's how
a zsh session with `en_US.ISO8859-1' can spawn a ksh session with a
Greek locale for example:
zsh> env | egrep '^(LANG|LC_ALL)'
LANG=en_US.ISO8859-1
LC_ALL=en_US.ISO8859-1
zsh> env LANG='el_GR.ISO8859-7' LC_ALL='el_GR.ISO8859-7' ksh
ksh$ mutt
Note that this is only ``half of the setup'' though. You will then have
to make sure that your terminal emulator can display ISO 8859-1 text
correctly, by choosing an appropriate font set. The xlsfonts(1) and the
fc-list(1) utilities can show you a list of installed fonts:
# xlsfonts | fgrep '8859-1'
# fc-list
Pick one that includes ISO 8859-1 characters, and off you go :)
More information about the freebsd-questions
mailing list