0

In a gnome-terminal as well as in a xfce4-terminal, when I change its character-encoding from standard UTF-8 (with 2 bytes for special-characters) to ISO-Latin 8859-15 (always 1 byte), the following happens:

While outputting of ISO-Latin encoded text works fine, for example:

cat textfile-iso-latin.txt

However input isn't working as expected. When I enter a special character (like Umlaut, Sonderzeichen, äöü) with the keyboard in the very same terminal, I need to hit the key on the keyboard twice in order to make it display.

Is the keyboard still in UTF-8 mode where such special characters take two bytes? How would I change this behaviour in order to make this hiccup disappear?

Thanks.

  • 1
    What utility do you type these characters into? E.g. your shell, bash? You need to update the locale settings (LANG and/or LC_* env variables) so that bash is informed about the new encoding. "Is the keyboard still in UTF-8 mode[...]?" – No, the input and output encodings are always the same, try typing into e.g. od -t x1 to make sure. – egmont Nov 1 '18 at 22:52
  • Thanks Egmont for your reply. I'm using a bash shell, and indeed the LANG was set to "de_DE.UTF-8", so being different from the terminal's encoding ISO-8859-15. However, since I don't want to install de_DE.ISO-LATIN-8859-15 system-wide (since the "locale" command says it's not installed) but just use the ISO-Latin encoding for the terminal of one user, I found the workaround with the "luit" command to be the easiest solution. Please see the exact description below in my new reply. – Fidelius Nov 2 '18 at 7:32
0

The easiest way to get ISO-Latin encoded input and output in my bash shell running in a full UTF-8 environment (as usual with Ubuntu) is to use the workaround which has been mentioned in a related but not identical question here: "Switch encoding of terminal with a command"

When in my UTF-8 xfce-terminal or gnome-terminal I run my old ISO-Latin encoded programs like this:

luit -encoding iso-8859-15 gawk -f script.awk

… then the luit tool converts the ISO-Latin encoded input and output of my program (an Awk script in that case) to the UTF-8 encoded terminal.

This workaround works fine (so far).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.