MacOS – How to get UTF-8 locale when connecting via SSH to MacOSX from PuTTY (Windows)

macosssh

I have the following problem. When I connect to the server via ssh (client is PuTTY under Windows), I don't get UTF-8 locale. Here is what I see on MacOSX (Yosemite) after ssh connection:

$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

The thing is that I use the same settings for my Linux connections and on Linux I don't have these problems with locale. So, this might be a problem on the MacOSX side, not on the PuTTY's side.

Any ideas how to have UTF-8?

Best Answer

Solved my problem using Stack Overflow question: https://stackoverflow.com/questions/7165108/in-osx-lion-lang-is-not-set-to-utf8-how-fix

The most important part of the answer:

Try adding or editing the ~/.profile file for it to correctly export your locale settings upon initiating a new session.

export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8