Interesting question. Even more interesting result:

```
wine64 main-c.exe | cat
```

will produce the expected result indeed
```
CP_UTF8 = 65001
foo 👋 bar

foo2 👋 bar
Hi there!
```

Why would this happen?

On Wed, Nov 13, 2019 at 2:14 PM Jactry Zeng <jactry92@gmail.com> wrote:
Hi Moritz,

What will happen if outputting the result to a file and open it with a text editor?

On Wed, Nov 13, 2019 at 5:59 AM Moritz Angermann <moritz.angermann@gmail.com> wrote:
Hi,

I've been trying to figure out why we have some issues with wine executing
our cross compiled haskell programs when unicode is involved.  I've been able
to distill this to the attached C program. Compiled with gcc-7.4.0 like

  x86_64-pc-mingw32-gcc  main.c -o main-c.exe -finput-charset=UTF-8

this yields an executable[1] that when invoked via wine will produce:

```
CP_UTF8 = 65001
foo foo2 Hi there!
```

when run on windows 10 in a cmd shell

```
CP_UTF8 = 65001
foo 👋 bar

foo2 👋 bar
Hi there!
```

I've tried this with wine3 and wine4, but keep getting the same
results. It appears as if wine is somehow choking on the encoded
bytes.

Any hints as to what might be wrong?

Cheers,
 Moritz

---
[1]: https://www.dropbox.com/s/bc2fhtuv1u25i1w/main-c.exe?dl=0


--
Regards,
Jactry Zeng