How to Fix – ERROR: Ansible requires the locale encoding to be UTF-8 Detected ISO8859-1.
August 16, 2023 2023-08-18 4:26How to Fix – ERROR: Ansible requires the locale encoding to be UTF-8 Detected ISO8859-1.
Once you have installed the Ansible package in your Ubuntu machine, you may get an error when you check the Ansible version using the command below,
ansible --version
ERROR: Ansible requires the locale encoding to be UTF-8; Detected ISO8859-1.
Open the configuration file/etc/default/locale and add the lines below if not added previously,
vim /etc/default/locale
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
And execute the command below and configure locale encoding to be UTF-8
sudo update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8
or use the command below to re-configure the locales and see the screenshot below.
sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales
Finally reboot or restart your machine.