If you get this kind of error when running a terminal or login with ssh on a machine : "perl: warning: Setting locale failed."

locale # to show the current locale
sudo vi /etc/locale.gen
    # comment everything that's uncommented or you don't want
    # uncomment the desired language (here : en_US.UTF-8)
sudo locale-gen en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8
# kill the terminal / disconnect your ssh session
# log again
locale