During remote access into Linux Centos/Redhat, it’s common to see setlocale error if using UTF-8 encoding; especially using terminal program like iterm / iterm2. This is due to iterm terminal allow to set the UTF-8 encoding environment.
This is the error you will see when SSH into the server; compiling perl; compiling python and etc.
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
To fix the error in Linux Centos/Redhat 6, follow the step below;
- Edit the file /etc/sysconfig/i18n, add this line into the file
LC_CTYPE="en_US.UTF-8"
2. In the file it should look like this.
LANG="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" SYSFONT="latarcyrheb-sun16"
To fix the error in Linux Centos/Redhat 7, follow the step below;
- Edit the file /etc/locale.conf, add this line into the file
LC_CTYPE="en_US.UTF-8"
2. In the file, it should look like this
LANG="en_US.UTF-8" LC_CTYPE="en_US.UTF-8"
That will fix the annoy error when compiling on Python/Perl.