--- title: Linux locale problems over ssh from a Mac author: james type: post date: 2011-10-06T08:07:16+00:00 url: /2011/10/linux-locale-problems-over-ssh-from-a-mac/ aktt_notify_twitter: - yes aktt_tweeted: - 1 dsq_thread_id: - 438230874 categories: - Debian - Hacks - Ubuntu --- Most users of Debian/Ubuntu have at some time seen these annoying messages: `
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
` There are a variety of causes – usually locales not being generated properly or incorrect environment variables. Lately I’ve been getting these a lot of these, but only some of the time. After some messing around I eventually discovered the problem wasn’t on the server itself. The problem only occurs when I’m logged in over SSH from a Mac. The default sshd on Debian **copies LANG and LC_* variables** from the client. The LC_CTYPE variable was set on my Mac, apparently by default, to “UTF-8”. While this seems to work on MacOS X, it’s not a valid value for Linux. The easiest solution was just to add the following to my ~/.profile on the Mac: `
export LC_CTYPE=en_GB.UTF-8
` That fixes it, and doesn’t appear to cause harm on the Mac.