{"id":63,"date":"2010-01-02T09:09:24","date_gmt":"2010-01-02T06:09:24","guid":{"rendered":"http:\/\/oss-it.su\/?p=63"},"modified":"2019-08-11T15:30:39","modified_gmt":"2019-08-11T12:30:39","slug":"%d0%b7%d0%b0%d0%bf%d1%83%d1%81%d0%ba-%d0%bf%d1%80%d0%b8%d0%bb%d0%be%d0%b6%d0%b5%d0%bd%d0%b8%d0%b9-%d1%81-%d0%bb%d0%be%d0%ba%d0%b0%d0%bb%d1%8c%d1%8e-cp1251","status":"publish","type":"post","link":"https:\/\/oss-it.su\/en\/63","title":{"rendered":"Run a program with a CP1251 locale"},"content":{"rendered":"<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Locale_(computer_software)\"><em>Locale<\/em><\/a> 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 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Unicode\">Unicode<\/a> 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 <em>Wine<\/em>). How to do this is described in this article.<\/p>\n<p>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:<\/p>\n<p><code>locale -a<\/code><\/p>\n<p>It will output all installed locales. If in this list, in addition to various variants of UTF, there is already <em>ru_RU.CP1251<\/em>, you can skip the stage of locale generation and go directly to the command to start the application. If <em>ru_RU.CP1251<\/em> is not detected there, you will have to generate it. In Ubuntu, you need to edit the file <em>\/var\/lib\/locales\/supported.d\/ru<\/em> for this purpose:<\/p>\n<p><code>sudo nano \/var\/lib\/locales\/supported.d\/ru<\/code><\/p>\n<p>In other distributions, the specific locale file can be located in other paths.<br \/>\nAdd the last line to this file:<\/p>\n<p><code>ru_RU.CP1251 CP1251<\/code><\/p>\n<p>Save the changes and start generating locales with the command:<\/p>\n<p><code>sudo locale-gen<\/code><\/p>\n<p>Generation complete.<\/p>\n<p>You can now run any application in the CP1251 windows-encoding. To do this, add <code>LC_ALL=ru_RU.CP1251<\/code>, for example, before starting an application:<\/p>\n<p><code>LC_ALL=ru_RU.CP1251 nano<\/code><\/p>\n<p>This command will launch the <em>nano<\/em> text editor with windows\u00a0 CP1251 encodeding.<br \/>\nTo run the windows application in this way through the <em>Wine<\/em> emulator, you will need to execute this type of command:<\/p>\n<p><code>env LC_ALL=ru_RU.CP1251 wine \"C:\\Program Files\\1Cv77\\BIN\\1cv7.exe\"<\/code><\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Local 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.<\/p>\n","protected":false},"author":1,"featured_media":788,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[15],"class_list":["post-63","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/comments?post=63"}],"version-history":[{"count":2,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":1069,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/63\/revisions\/1069"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/media\/788"}],"wp:attachment":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/media?parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/categories?post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/tags?post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}