macOS Iterm remote ssh reported LC_CTYPE warning, Chinese garbled problem

Posted May 27, 20201 min read

Mac migration to a new computer, use Iterm remote ssh server to log in, all show
setlocale:LC \ _CTYPE:cannot change locale(UTF-8):No such file or directory

The Chinese returned by ssh remotely shows garbled characters. I searched for it because mac ssh passed the LANG environment variable in mac in the past, which did not match the default environment parameters of the remote server.
Correct solution:

vim/etc/ssh/ssh_config #Open the ssh_config configuration file

SendEnv LANG LC_ALL = en.US.UTF-8 #Modify the corresponding line