Home » Server » zsh (anon):12: character not in range – Powerline characters for zsh

zsh (anon):12: character not in range – Powerline characters for zsh


Usually themes in zsh works out of the box with oh my zsh framework. But sometimes we use KDE and Konsole we get some weird error of zsh character not in range like errors.

zsh (anon):12: character not in range

How to solve this problem. For that first we want to identify what causes this problem. The problem is with reading unicode character in the shell especially zsh. We want to check the locale settings first. for that type locale on the terminal

[email protected] ~ locale
LANG=en_US.UTF-8
LANGUAGE=en_IN:en
LC_CTYPE=C
LC_NUMERIC=C
LC_TIME=en_IN.UTF-8
LC_COLLATE=C
LC_MONETARY=”en_US.UTF-8″
LC_MESSAGES=”en_US.UTF-8″
LC_PAPER=”en_US.UTF-8″
LC_NAME=”en_US.UTF-8″
LC_ADDRESS=”en_US.UTF-8″
LC_TELEPHONE=”en_US.UTF-8″
LC_MEASUREMENT=C
LC_IDENTIFICATION=”en_US.UTF-8″
LC_ALL=

If you get an output like this then it may be correct. Then the next problem causing a character not in range is with the setting of the locales.

ZSH Demo - character not in range

Enable the desired locales in /etc/locale.gen and run locale-gen

$ cat /etc/locale.gen |grep UTF 
$ en_US.UTF-8 UTF-8 en_GB.UTF-8 UTF

Then run the locale-gen command to generate the preffered locales. This will fix the problem.

Also the localectrl can also fix the problem

localectl set-locale LANG=en_AU.UTF-8

If the locales are loaded correctly you will get

$ locale -a
C
C.UTF-8
POSIX
en_GB.utf8
en_IN
en_IN.utf8
en_US.utf8

You can find the discussion on superuser, githubissue and archform.

Image credit: Commons.wikimedia.org

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.