2

This question pertains to my Ubuntu 18 system, as follows ...

% uname -a
Linux myhost.name.net 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I don't know how long the following has been going on in the midst of my regular system upgrades, but I have now noticed that all my terminal windows are writing UTF-8 characters. I want all terminal windows to use us.ascii (or possibly iso-8859-1). I can't find anywhere where this is set.

Furthermore, all keyboard input seems to be coming in as UTF-8, and I also want it to be us.ascii or iso-8859-1.

By default, the LANG variable is set to en_US.UTF-8 in all shells that run in my terminal windows, but I am not knowingly setting it that way within any config files.

This occurs under xterm, rxvt, and urxvt, and none of these programs are configured to utilize UTF-8, that I know of.

I'm running XFCE4, if that makes any difference. I can't find any settings for this in the XFCE4 settings, either.

Can anyone suggest a way to reset my system so that all terminal windows always display us.ascii or iso-8859-1, and all keyboard input is also us.ascii or iso-8859-1?

Thank you very much.

3
  • 3
    "my terminal windows are writing UTF-8 characters" – Could you please elaborate on this? Linux systems have been using UTF-8 by default for about 10–15 years now. us.ascii is a subset of that, if you only use the very basic English letters and symbols present in the US keyboard then UTF-8 should be just as good for you. There is no encoding called iso-8859, there are multiple incompatible ones called iso-8859-1, iso-8859-2 and so on. Which one would you need, and for what? What is the actual problem you're running into?
    – egmont
    Mar 17, 2019 at 15:41
  • 1
    I meant iso-8859-1. I will correct above in a moment. The problem is that when I copy text from my terminal and try to paste it elsewhere, special characters such as apostrophe and double quote are showing up as multibyte sequences. I want them to show up as single bytes within the 7-bit ascii range. In other words, I want to force the us.ascii subset of utf-8
    – HippoMan
    Mar 17, 2019 at 15:59
  • Where are you seeing this? us-ascii is a strict subset of both UTF-8 and all of the iso-8859-x. The characters you mention symmetric-double-quote, and apostrophe, are part of us-ascii, and a single byte in utf-8 (same encoding as us-ascii). Most Unixes have been using utf-8 for at least 10 years. Can you show us what is going wrong. This could be an XY problem. Mar 17, 2019 at 16:05

1 Answer 1

2

You aren't finding any specific settings because the overwhelming majority of modern Linux software decides the character set to be used by the locale environment variables. Use the locale command to view the full set of current locale settings.

Have you checked /etc/default/locale? It is the standard Debian configuration file for setting the system default locale. If you want to use iso-8859-1 instead of UTF-8, you should:

  • make sure that the en_US ISO-8859-1 line is uncommented in /etc/locale.gen and run sudo locale-gen after editing the file if it wasn't
  • specify the LANG locale variable (or at least LC_CTYPE) as en_US.iso88591 (or whatever is the correct form according to locale -a | grep en_US)

If the problem is that you're connecting from your Ubuntu 18 UTF-8 system to legacy systems that use ISO-8859-1 instead of UTF-8, you might consider inserting a character mapping layer on your outgoing connections instead of downgrading your entire system to deal with the legacy encoding. Make a tiny script (or a shell function) like this:

#!/bin/sh
luit -encoding 'ISO 8859-1' ssh "$@"

(If you want to enforce strict US-ASCII for the remote endpoint, replace ISO 8859-1 with ASCII.)

Name it whatever you want. Use this script/function instead of the regular ssh command when connecting to the systems using legacy character encoding.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .