Bash – How to fix character encoding in bash (arch linux)

arch linuxbashcharacter encoding

I have some issues with the encoding of german umlauts in bash.
It mostly is working fine, but when i am typing a invalid command, the error message generated by bash contains strange escape sequences and not the actual characters.

Here is a log, which shows the problem:

[root@myhost ~]# mkdir ä
[root@myhost ~]# ä
-bash: $'\303\244': Kommando nicht gefunden.
[root@myhost ~]# ü
-bash: $'\303\274': Kommando nicht gefunden.
[root@myhost ~]# ls
ä  äöü  Projects  tbb
[root@myhost ~]# cat äöü
äüö
[root@myhost ~]# rm ä
rm: Entfernen von „ä“ nicht möglich: Ist ein Verzeichnis
[root@myhost ~]# rmdir ä
[root@myhost ~]# rm äöü

the configuration of my /etc/rc.conf:

LOCALE="de_DE.UTF-8"
DAEMON_LOCALE="no"
HARDWARECLOCK="localtime"
TIMEZONE="Europe/Berlin"
KEYMAP="de-latin1"
CONSOLEFONT=
CONSOLEMAP=
USECOLOR="yes"

/etc/locale.gen only contains the de_DE locales:

de_DE.UTF-8 UTF-8
de_DE ISO-8859-1
de_DE@euro ISO-8859-15

locale output:

LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

Best Answer

This seems to be introduced with bash 4.2. You can report this as a bug to the bash developers.

Related Question