Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1047

-bash: warning: setlocale: LC_ALL: cannot change locale (en_us.utf-8)

$
0
0

After I upgrade my Mac from Sierra to High Sierra, I got the setlocale warning when I use Terminal SSH to connect to Centos (6 and 7).

Thought there are a few workaround to the problems, I found the problem was that the locale environment variables in .bash_profile are in all lower case en_us.utf-8. Changing it to en_US.UTF-8 fixed the problems.

Other solutions I tried, found on the Internet were:

In CentOS (the server)

  • Set LC_LANG=en_US.utf8 in /etc/environments fix the problem.

In Mac (the client)

  • Remove SendEnv LC in ssh_config fix the problem

If I run locale -a, the locale is

en_US.utf8 on CentOS and

en_US_UTF-8 on MacOS

It seems the normalization procedures of locale variables in CentOS and MacOS are different. On CentOS, it seems it normalizes UTF-8 to lowercase and will remove the hyphen but requires en_US in this exact case. On MacOS, it seems it normalizes to uppercase and needs the hyphen and accepts any case mix for en_US. So a compatible setting is en_US.UTF-8 where the three letters UTF can be in any case.

(That is why I cannot fix the problem by I setting the locale variables to en_US.utf8 in Mac, it will change the LC_ALL to blank.)

So what is the standard normalization procedure? Or is there a standard?

Another thing I don't understand is why it only happened after I upgraded to High Sierra. I found my .bash_profile setting was using en_us.utf-8 so why did I not get the warning message earlier? The two possible guesses are

  • High Sirrea changed the ssh_config after upgrade (by adding SendEnv), or

  • Sierra normalizes the LC_ALL environments variable in Terminal.


Viewing all articles
Browse latest Browse all 1047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>