There are numerous related questions, but none of the answers solve this specific case:
I am on MacOS, using iTerm2 and ZSH.
Any AWS EC2 instance with the Amazon image (and maybe others) will show me that line when connecting to them with SSH:
setlocale: LC_CTYPE: cannot change locale (UTF-8)
The common answer to this problem seems to be a fix on the server. But this is not what I am looking for, I would like a fix on the client (since we create and destroy EC2 instances quite regularly).
I've tried to add this to my .zshrc file:
export LC_CTYPE=UTF-8
ihinking that if it is already set to that locale, it won't complain. But that didn't work.
In iTerm2, there is an option:
I tried to disable that, but no change as well.
How can this be fixed?
CodePudding user response:
"UTF-8" looks like the name of a charset, not the name of a locale. That may be a valid locale on macOS but probably isn't on the EC2 servers. On a Linux system, you can list available locales with locale -a
. Try values like en_US.UTF-8
or perhaps C.UTF-8
. If available, the latter is probably preferable.
It is probably better to set it from .zprofile
rather than .zshrc
and perhaps only conditionally if the existing value is "UTF-8":
[[ $LC_CTYPE = UTF-8 ]] && LC_CTYPE=C.UTF-8