How to enable UTF-8 in Linux? [SOLVED]

Written By - Omer Cakmak

What is UTF-8?

UTF-8 (Unicode Transformation Format) is an 8-bit Unicode conversion format. It is used to encode Unicode characters in groups of 8-bit variable byte numbers. Character encoding is a way of telling a computer how to interpret raw zeros and ones into real characters. When we write text to a file, the words and sentences we create are made up of different characters, and the characters are arranged in a character set. Or the codes written in a programming language are converted into this format by the system and presented to the user.

For example, in the Mousepad application, UTF-8 is defined as the default encoding:

How to enable UTF-8 in Linux? [SOLVED]


If you are working on Linux operating system, you should use these converters. If you have received a warning/error regarding UTF-8, read this post. In this article, we will explain the steps to enable UTF-8 on Linux operating systems.

Let's enable UTF-8 for systems based on major distributions that are used by most users on Linux.


How to enable UTF-8 Redhat Based OS

The following steps can be applied in linux distributions based on Redhat operating system such as Centos, Rocky Linux, AlmaLinux, Fedora, etc.


Step-1: Show current UTF-8 settings

First view the settings current in the system:

[foc@rocky9 ~]$ locale


[foc@rocky9 ~]$ localectl 
   System Locale: LANG=en_GB.UTF-8
       VC Keymap: us
      X11 Layout: us

The language you used and the UTF format are also displayed.



Step-2: Show the list of available locales

Use the following command to list available languages and UTF formats:

[foc@rocky9 ~]$ localectl list-locales

After this command, you will see a long list.


Step-3: Change UTF-8 setting

To change the UTF settings, you can do it by giving the set-locale and LANG parameters to the localectl command. For example:

[foc@rocky9 ~]$ sudo localectl set-locale LANG=en_US.UTF-8

or you can manually edit the /etc/locale.conf file:

[foc@rocky9 ~]$ sudo vi /etc/locale.conf

Change en_GB.UTF-8 to en_US.UTF-8. Then check system locale settings:

[foc@rocky9 ~]$ cat /etc/locale.conf 


How to enable UTF-8 Debian Based OS

In this step, let's explain how to make UFT settings in distributions such as Debian based systems, Pardus, Ubuntu, Mint.


Step-1: Show current UTF-8 settings

You can view the UTF settings with the locale command:

foc@ubuntu22:~$ locale


Step-2: Show the list of available locales

Reconfigure the locales package to show the list of available locales:

foc@ubuntu22:~$ sudo dpkg-reconfigure locales

enable UTF-8


Step-3: Change UTF-8 setting

Run the locales package with root user or sudo:

How to enable UTF-8 in Linux? [SOLVED]


Select UTF and language from the list. Determine which of the selected settings will be default:

How to enable UTF-8 in Linux? [SOLVED]


Press OK:

foc@ubuntu22:~$ sudo dpkg-reconfigure locales
Generating locales (this might take a while)...
  en_GB.UTF-8... done
  en_US.UTF-8... done
  tr_TR.UTF-8... done
Generation complete.

The settings have been applied successfully.


References - How can I enable UTF-8 support in the Linux console?


Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment