Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Feb 2007 23:15:00 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Peter <pmatulis@sympatico.ca>
Cc:        freebsd-questions@freebsd.org, apatewna@yahoo.gr
Subject:   Re: toggle between english and french (how?)
Message-ID:  <20070209211500.GA6016@kobe.laptop>
In-Reply-To: <200702091142.18723.pmatulis@sympatico.ca>
References:  <200702061729.09543.pmatulis@sympatico.ca> <200702090053.52505.pmatulis@sympatico.ca> <20070209152625.GA3512@kobe.laptop> <200702091142.18723.pmatulis@sympatico.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2007-02-09 11:42, Peter <pmatulis@sympatico.ca> wrote:
>Le Vendredi 9 F??vrier 2007 10:26, Giorgos Keramidas a ??crit :
>> Not really.  I'm just trying to understand why you have to change the
>> *remote* keyboard map.  The local keyboard map is what really
>> matters, and this should work fine with the remote shell enrivonment
>> for any locale/language.
> 
> Ok.  What I want to be able to do is *occasionally* edit files in French 
> *remotely*.  That's all.

Then you don't have to change the 'remote' keymap.  Especially not the
remote *console* keymap.

I'm often editing files in Greek (el_GR.ISO8859-7) over an SSH
connection to a Solaris machine somewhere else.  The setup I use is
described below:

[1] My .bashrc contains:

    ,-----------------------------------------------------------------
    | # 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
    `-----------------------------------------------------------------

    This makes sure that bash (even the shell I'm using as a login shell
    before X11 fires up) knows that my local language environment is
    `el_GR.ISO8859-7', that it is ok to display characters from this
    locale (LC_CTYPE), and that I want sorting to be done according to
    the sorting rules of the `el_GR.ISO8859-7' locale.

[2] I'm firing up X11 and I have made sure my .xinitrc file does not
    override the LANG or LC_XXX environment variables mentioned below.

[3] My /etc/X11/xorg.conf contains:

    ,-----------------------------------------------------------------
    | Section "InputDevice"
    |     Identifier      "Keyboard0"
    |     Driver          "keyboard"
    |     Option          "XkbRules" "xorg"
    |     Option          "XkbModel" "pc105"
    | 
  + |     # Support for Greek input.  You must also have a matching locale
  + |     # setup in the environment of your xinit process.
  + |     Option          "XkbLayout"  "us,el"
  + |     Option          "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll,compose:ralt"
    | EndSection
    `-----------------------------------------------------------------

    Note the lines marked with a '+'.  These let my X11 desktop switch
    from Greek to English keyboard input, by hitting the left ALT and
    left SHIFT keys together.

    What characters are sent to applications is entirely a matter of
    this local setup, and is not really controlled by a remote server.

    For the remote server it doesn't really matter if you are typing on
    a keyboard, pasting text from a web browser, copying text using
    screen(1) from one terminal and pasting it to an ssh window, etc.

Now, even with these three options, remote servers need just a small
tweak to be able to 'read' what you sent over an SSH connection and
correctly grok it as Greek (or French, in your case) text.  They have to
be notified that your locale permits these characters to be printed.

This is done by setting in your *remote* .bashrc file the same locale
environment variables:

    ,-----------------------------------------------------------------
    | # 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
    `-----------------------------------------------------------------

That is all it should take to let the remote server know that it is ok
to display Greek characters.

Some applications, i.e. bash(1) may need additional tweaks to allow
input and/or display of 8-bit character sets (like Greek or French).
For instance, in my .inputrc file (configuration file for the 'readline'
library, and all the programs that use it; i.e. bash), I also have:

    ,-----------------------------------------------------------------
    | set convert-meta Off
    | set editing-mode emacs
    | set input-meta On
    | set output-meta On
    `-----------------------------------------------------------------

This is present in all my .bashrc files (both local and remote ones).

For reading, inputting and displaying French characters using an X11
desktop, you will have to do something similar, but `el_GR.ISO8859-7'
will have to be replaced with one of the French locales.

For reading, inputting and displaying French characters using a console
session (i.e. one where your local system hasn't started X11 yet), you
will have to do something similar *plus* change the *local* console
keymap to support French input.  The rest of the necessary settings for
the environment and the LANG/LC_XXX values remain the same as in X11
(except, obviously, the ones inside `xorg.conf').

I hope this clarifies things a bit :)  If not, feel free to provide us
with more details about the setup you are trying to configure.

- Giorgos





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070209211500.GA6016>