Sunday, January 13, 2013

How to fix your locale settings for Mosh

Mosh is a great tool. It does require a UTF-8 environment.

The "locale" command will show your local locale settings:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
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="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


On Debian based systems like Ubuntu the LANG environment variable will be sent in the SSH session. (This is the SendEnv setting in /etc/ssh/ssh_config)

But for iSSH on the iPhone this won't do. This will pick the environment as defined in /etc/default/locale. To set the locale put the following line in /etc/default/locale and run sudo update-locale.
LANG="en_US.UTF-8"

For further troubleshooting:
1. Check your 'local' environment
2. Check if your SSH sends an environment variable
3. Check the contents of /etc/default/locale on the server

1 comment: