mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl and legacy win32 apps through wine
@ 2015-11-17  6:21 Рысь
  2015-11-17 21:02 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Рысь @ 2015-11-17  6:21 UTC (permalink / raw)
  To: musl

Hello.

I came to need to run few legacy win32 apps in wine (2d programs of
specific nature).

I had built wine myself which links with musl fine.

These programs are Russian only. They do not have English fallback or
any other translated versions. Their texts are of cp1251 encoding.

I unable to read them because they are garbled probably because they
are converted to utf-8 implicitly. However if I set LC_ALL=ru_RU.UTF-8,
wine own translation is shown as expected - I see clear Russian
translation. Only those legacy programs are in trouble.

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.

I only need Wine for these few programs. I now running a chroot with
debian glibc and wine as a temporary solution.

-- 
http://lynxlynx.tk/
Power electronics made simple
Unix and simple KISS C code


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: musl and legacy win32 apps through wine
  2015-11-17  6:21 musl and legacy win32 apps through wine Рысь
@ 2015-11-17 21:02 ` Rich Felker
  2015-11-18  2:45   ` Рысь
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2015-11-17 21:02 UTC (permalink / raw)
  To: musl

On Tue, Nov 17, 2015 at 01:21:15PM +0700, Рысь wrote:
> Hello.
> 
> I came to need to run few legacy win32 apps in wine (2d programs of
> specific nature).
> 
> I had built wine myself which links with musl fine.
> 
> These programs are Russian only. They do not have English fallback or
> any other translated versions. Their texts are of cp1251 encoding.
> 
> I unable to read them because they are garbled probably because they
> are converted to utf-8 implicitly. However if I set LC_ALL=ru_RU.UTF-8,
> wine own translation is shown as expected - I see clear Russian
> translation. Only those legacy programs are in trouble.
> 
> 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.
> 
> I only need Wine for these few programs. I now running a chroot with
> debian glibc and wine as a temporary solution.

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.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: musl and legacy win32 apps through wine
  2015-11-17 21:02 ` Rich Felker
@ 2015-11-18  2:45   ` Рысь
  2015-11-18  6:32     ` Рысь
  0 siblings, 1 reply; 6+ messages in thread
From: Рысь @ 2015-11-18  2:45 UTC (permalink / raw)
  To: musl

On Tue, 17 Nov 2015 16:02:49 -0500
Rich Felker <dalias@libc.org> wrote:

> On Tue, Nov 17, 2015 at 01:21:15PM +0700, Рысь wrote:
> > Hello.
> > 
> > I came to need to run few legacy win32 apps in wine (2d programs of
> > specific nature).
> > 
> > I had built wine myself which links with musl fine.
> > 
> > These programs are Russian only. They do not have English fallback
> > or any other translated versions. Their texts are of cp1251
> > encoding.
> > 
> > I unable to read them because they are garbled probably because they
> > are converted to utf-8 implicitly. However if I set
> > LC_ALL=ru_RU.UTF-8, wine own translation is shown as expected - I
> > see clear Russian translation. Only those legacy programs are in
> > trouble.
> > 
> > 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.
> > 
> > I only need Wine for these few programs. I now running a chroot with
> > debian glibc and wine as a temporary solution.
> 
> 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.
> 
> Rich

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.

-- 
http://lynxlynx.tk/
Power electronics made simple
Unix and simple KISS C code


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: musl and legacy win32 apps through wine
  2015-11-18  2:45   ` Рысь
@ 2015-11-18  6:32     ` Рысь
  2015-11-18 16:24       ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Рысь @ 2015-11-18  6:32 UTC (permalink / raw)
  To: musl

On Wed, 18 Nov 2015 09:45:58 +0700
Рысь <lynx@lynxlynx.tk> wrote:

> On Tue, 17 Nov 2015 16:02:49 -0500
> Rich Felker <dalias@libc.org> wrote:
> 
> > On Tue, Nov 17, 2015 at 01:21:15PM +0700, Рысь wrote:
> > > Hello.
> > > 
> > > I came to need to run few legacy win32 apps in wine (2d programs
> > > of specific nature).
> > > 
> > > I had built wine myself which links with musl fine.
> > > 
> > > These programs are Russian only. They do not have English fallback
> > > or any other translated versions. Their texts are of cp1251
> > > encoding.
> > > 
> > > I unable to read them because they are garbled probably because
> > > they are converted to utf-8 implicitly. However if I set
> > > LC_ALL=ru_RU.UTF-8, wine own translation is shown as expected - I
> > > see clear Russian translation. Only those legacy programs are in
> > > trouble.
> > > 
> > > 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.
> > > 
> > > I only need Wine for these few programs. I now running a chroot
> > > with debian glibc and wine as a temporary solution.
> > 
> > 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.
> > 
> > Rich
> 
> 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.
> 

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                                                                               
#include <locale.h>
#include <string.h>

char d[64];

char *setlocale(int cat, const char *locale)
{
	char *p = d;

	strcpy(d, "ru_RU.UTF-8");
	return p;
}

% cc -shared -fPIC libbrklocale.c -o libbrklocale.so
% LD_PRELOAD=./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.

-- 
http://lynxlynx.tk/
Power electronics made simple
Unix and simple KISS C code


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: musl and legacy win32 apps through wine
  2015-11-18  6:32     ` Рысь
@ 2015-11-18 16:24       ` Rich Felker
  2015-11-18 16:34         ` Рысь
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2015-11-18 16:24 UTC (permalink / raw)
  To: musl

On Wed, Nov 18, 2015 at 01:32:44PM +0700, Рысь wrote:
> 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                                                                               
> #include <locale.h>
> #include <string.h>
> 
> char d[64];
> 
> char *setlocale(int cat, const char *locale)
> {
> 	char *p = d;
> 
> 	strcpy(d, "ru_RU.UTF-8");
> 	return p;
> }
> 
> % cc -shared -fPIC libbrklocale.c -o libbrklocale.so
> % LD_PRELOAD=./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.

Are you perhaps using an older version of musl? Recent versions should
report the locale you requested for all categories, not a mix of C and
your requested locale.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: musl and legacy win32 apps through wine
  2015-11-18 16:24       ` Rich Felker
@ 2015-11-18 16:34         ` Рысь
  0 siblings, 0 replies; 6+ messages in thread
From: Рысь @ 2015-11-18 16:34 UTC (permalink / raw)
  To: musl

On Wed, 18 Nov 2015 11:24:18 -0500
Rich Felker <dalias@libc.org> wrote:

> On Wed, Nov 18, 2015 at 01:32:44PM +0700, Рысь wrote:
> > 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 #include <locale.h>
> > #include <string.h>
> > 
> > char d[64];
> > 
> > char *setlocale(int cat, const char *locale)
> > {
> > 	char *p = d;
> > 
> > 	strcpy(d, "ru_RU.UTF-8");
> > 	return p;
> > }
> > 
> > % cc -shared -fPIC libbrklocale.c -o libbrklocale.so
> > % LD_PRELOAD=./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.
> 
> Are you perhaps using an older version of musl? Recent versions should
> report the locale you requested for all categories, not a mix of C and
> your requested locale.
> 
> Rich

Probably so (1.1.4 with my patches), but I have succeeded in working
around it again, so I continue to use it because it just works :-)

-- 
http://lynxlynx.tk/
Power electronics made simple
Unix and simple KISS C code


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-18 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-17  6:21 musl and legacy win32 apps through wine Рысь
2015-11-17 21:02 ` Rich Felker
2015-11-18  2:45   ` Рысь
2015-11-18  6:32     ` Рысь
2015-11-18 16:24       ` Rich Felker
2015-11-18 16:34         ` Рысь

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).