Locale is a set of parameters, including character set, user language, country, time zone, and other presets that the user expects to see in the user interface. Linux operating systems use Unicode encodings as the default locales, which is certainly very convenient and versatile. But sometimes it is necessary to run a single application with CP1251 encoding (e.g. win32-program via Wine). How to do this is described in this article.
Everything described below is relevant for Ubuntu distributions, and will also work on all other Debian and RedHat-based systems. So, first of all, we need to find out which locales are already installed in your system by typing in the command:
It will output all installed locales. If in this list, in addition to various variants of UTF, there is already ru_RU.CP1251, you can skip the stage of locale generation and go directly to the command to start the application. If ru_RU.CP1251 is not detected there, you will have to generate it. In Ubuntu, you need to edit the file /var/lib/locales/supported.d/ru for this purpose:
sudo nano /var/lib/locales/supported.d/ru
In other distributions, the specific locale file can be located in other paths.
Add the last line to this file:
Save the changes and start generating locales with the command:
You can now run any application in the CP1251 windows-encoding. To do this, add
LC_ALL=ru_RU.CP1251, for example, before starting an application:
This command will launch the nano text editor with windows CP1251 encodeding.
To run the windows application in this way through the Wine emulator, you will need to execute this type of command:
env LC_ALL=ru_RU.CP1251 wine "C:\Program Files\1Cv77\BIN\1cv7.exe"
If this way of running the program solves the encoding problems, you can safely create a quick start button, where it will be easy enough to put this command.