From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8892 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?0KDRi9GB0Yw=?= Newsgroups: gmane.linux.lib.musl.general Subject: Re: musl and legacy win32 apps through wine Date: Wed, 18 Nov 2015 13:32:44 +0700 Message-ID: <20151118133244.3ff957eb@r2lynx> References: <20151117132115.02be8539@r2lynx> <20151117210248.GC3818@brightrain.aerifal.cx> <20151118094558.1cc82bee@r2lynx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1447828314 9040 80.91.229.3 (18 Nov 2015 06:31:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Nov 2015 06:31:54 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8905-gllmg-musl=m.gmane.org@lists.openwall.com Wed Nov 18 07:31:46 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZywHP-0006iS-MN for gllmg-musl@m.gmane.org; Wed, 18 Nov 2015 07:31:43 +0100 Original-Received: (qmail 14157 invoked by uid 550); 18 Nov 2015 06:31:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 14133 invoked from network); 18 Nov 2015 06:31:41 -0000 X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=ALL_TRUSTED,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.0 In-Reply-To: <20151118094558.1cc82bee@r2lynx> X-Mailer: claws Xref: news.gmane.org gmane.linux.lib.musl.general:8892 Archived-At: On Wed, 18 Nov 2015 09:45:58 +0700 =D0=A0=D1=8B=D1=81=D1=8C wrote: > On Tue, 17 Nov 2015 16:02:49 -0500 > Rich Felker wrote: >=20 > > On Tue, Nov 17, 2015 at 01:21:15PM +0700, =D0=A0=D1=8B=D1=81=D1=8C wrot= e: > > > Hello. > > >=20 > > > I came to need to run few legacy win32 apps in wine (2d programs > > > of specific nature). > > >=20 > > > I had built wine myself which links with musl fine. > > >=20 > > > These programs are Russian only. They do not have English fallback > > > or any other translated versions. Their texts are of cp1251 > > > encoding. > > >=20 > > > I unable to read them because they are garbled probably because > > > they are converted to utf-8 implicitly. However if I set > > > LC_ALL=3Dru_RU.UTF-8, wine own translation is shown as expected - I > > > see clear Russian translation. Only those legacy programs are in > > > trouble. > > >=20 > > > Is there a way to tell Wine or to emulate it cp1251 encoding? > > > Maybe I could modify Wine somehow to convert texts to proper > > > UTF-8? I did not found Wine uses iconv or something like that > > > inside it's source. > > >=20 > > > I only need Wine for these few programs. I now running a chroot > > > with debian glibc and wine as a temporary solution. > >=20 > > I'm not really familiar with how Wine emulates the Windows locale > > system, but if I remember right from when I once used it for QQ > > (which needed a legacy Chinese locale), it ties the emulated locale > > to the host locale. If so this is of course really problematic > > since the host locale on a modern system always uses UTF-8 encoding > > and legacy Windows apps never use/expect it. Probably some hack is > > needed on the Wine side to work around this but I'm not sure what > > it would look like. > >=20 > > Rich >=20 > OK got it, I already looked into it's guts, but they messy even about > locale stuff. Maybe I will be able to adapt it at least for my needs. >=20 I managed to get it work easily - the fact that Wine does all encoding by it's own powers happily eases the task, and drafts to using the simple LD_PRELOAD hack: % cat libbrklocale.c = =20 #include #include char d[64]; char *setlocale(int cat, const char *locale) { char *p =3D d; strcpy(d, "ru_RU.UTF-8"); return p; } % cc -shared -fPIC libbrklocale.c -o libbrklocale.so % LD_PRELOAD=3D./libbrklocale.so wine prog1251.exe I can hardcore it into Wine itself by calling appropriate setlocale from somewhere, but it's easier to use it as is since my Wine setup is going into separate chroot directory. The problem was discovered with Wine debugging facility, it got mixed locale with mixed "C" and "ru_RU.UTF-8" for LC_ALL/LC_MESSAGES/LC_CTYPE. It used latter for encoding, and text was garbled. Now everything is consistent and works flawlessly. --=20 http://lynxlynx.tk/ Power electronics made simple Unix and simple KISS C code