This happens all the times to me. Keeping a note here..
for Centos
https://www.noreplied.com/how-to-fixed-cannot-change-locale-utf-8-error-in-centos-7/
cat 'LC_CTYPE="en_US.UTF-8"' >> /etc/environment
For Ubuntu
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8 en_US
dpkg-reconfigure locales
->> choose 149 and 3