How to Fixed “cannot change locale (UTF-8)” Error in Centos 7

Previously we have shared how to fix the LC_Type locale error in Centos 6 and the steps below will show how to fix the error message “warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory” in CentOS 7.

If you terminal has set to UTF-8 and most probably will get the error messages after remotely ssh into the server

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

The errors not only in terminal, it’s possible appear when compiling stuff in Perl or Python as well.

The fix the error above, fire up the file /etc/environment and add this one liner will magically made the error puff… go away.

LC_CTYPE="en_US.UTF-8"