You are not logged in.

#1 2018-07-20 11:54:17

Unturned
Member
Registered: 2017-04-16
Posts: 30

Wine can't display Chinese characters

Hello,
I have a windows executable that asks for your username & password and launches a web browser to let you enter a website if the credentials are correct. This is a text-only program and it launches it self in a console in Windows. When I tried to run it using Wine on Arch, all the messages (written in Chinese) are displayed as garbage characters. I looked up Wine's documentation but the procedures only work for applications running with a GUI. I already have Chinese fonts installed on my Arch system and symlinked it into the C:/windows/Fonts folder in the Wine prefix, but it doesn't seem to work. Any ideas?

Thanks!

Offline

#2 2018-07-20 13:53:38

seth
Member
Registered: 2012-09-03
Posts: 50,924

Re: Wine can't display Chinese characters

Maybe a screenshot of the "garbage" would be a good idea.
Does it run in your VTE or does it open a cmd.exe window? If the former, try launching the latter and execute it there.

Offline

#3 2018-07-20 14:57:03

Unturned
Member
Registered: 2017-04-16
Posts: 30

Re: Wine can't display Chinese characters

These are the characters printed by the program when I ran it:

Z:\mnt\tsinsen>TsinsenLogin
╟δ╩Σ╚δ╙├╗º├√ú║
╟δ╩Σ╚δ├▄┬δú║
╒²╘┌╡╟┬╝ú¼╟δ╔╘║≥...
┤φ╬≤ú¼═°┬τ┴¼╜╙┤φ╬≤íú
Press any key to continue... 

I typed "wine cmd.exe" and it gave me a DOS terminal, running inside the original urxvt window. I guess it is still running inside my VTE? It doesn't launch a new graphical window.

Offline

#4 2018-07-20 15:06:37

seth
Member
Registered: 2012-09-03
Posts: 50,924

Re: Wine can't display Chinese characters

That's UTF-16.
I'ev no idea how smart wine/cmd.exe would be on translating this, but am afraid it's not going to work this way either.

wineconsole cmd

might do (should spawn a windows TE)

Offline

#5 2018-07-21 04:04:09

Unturned
Member
Registered: 2017-04-16
Posts: 30

Re: Wine can't display Chinese characters

Yes "wineconsole cmd" does spawn a separate cmd.exe window.
I tried to run wineconsole with "LC_ALL=zh_CN.utf8". It made the window title into Chinese instead of English, but it didn't affect the cmd.exe running inside it.

Offline

#6 2018-07-21 05:06:05

seth
Member
Registered: 2012-09-03
Posts: 50,924

Re: Wine can't display Chinese characters

It wouldn't help you anyway - you need something that renders UTF-16, not some utf-8 locale (where the locale only controls the language)
No POSIX shell will do that (because UTF-16 isn't ASCII compatible), so your best hope is that some windows program (or the wineconsole) does.

You can convert those strings using eg. inconv, but it's not designed to "tap" into a programs output. And idk of an exisiting wrapper lib to be preloaded to provide such feature.

Offline

#7 2018-07-23 09:08:28

Unturned
Member
Registered: 2017-04-16
Posts: 30

Re: Wine can't display Chinese characters

Hey,
How do you know that these characters are UTF-16? Is there a software that judges this?

I tried this to convert the characters to UTF-8 (original.txt contained the characters):

 iconv -f UTF-16 -t UTF-8 original.txt > output.txt 

But it just gave me more garbage characters that looks like a combination of Korean, and Chinese:

 鿎듢閩캣髎듢閙鳢閗슺鳢袚쎺鄊 

Am I supposed to convert it into UTF-8?

Offline

#8 2018-07-23 12:02:50

seth
Member
Registered: 2012-09-03
Posts: 50,924

Re: Wine can't display Chinese characters

Because windows operates on utf16 and instead of graphics elements ascii, you at least end up in the asian character set.
Your paste looks more like UTF-16BE (big endian) than UTF-16LE (little endian, windows default - I assume there's no BOM available)

Edit: that said, GB18030 produces chinese as well. I assume you can read that and infer what makes sense and what does not?
translate.google.com says the first token, "鈺熚粹暕危鈺毼粹暀鈹溾晽潞鈹溾垰煤", means "Nazi endangered pure coal" …

Last edited by seth (2018-07-23 14:59:46)

Offline

#9 2018-08-01 14:34:57

Unturned
Member
Registered: 2017-04-16
Posts: 30

Re: Wine can't display Chinese characters

I asked around on the wine forums & IRC channel but it seems like that nobody knows the solution. They suggested me to file a bug report at wine.
Originally I thought there must be a simple fix to this issue, but it seems like that it's quite complicated sad

Offline

#10 2018-08-05 01:45:48

Unturned
Member
Registered: 2017-04-16
Posts: 30

Re: Wine can't display Chinese characters

Hey,
After a bit more googling, I found this page on StackOverflow which describes how the font encodings work in cmd.exe:
https://stackoverflow.com/questions/125 … -exe-using
However it seems like the cmd.exe implementation inside Wine does not support the "chcp" command, so I can't change the encoding to UTF-8....

Last edited by Unturned (2018-08-05 01:46:26)

Offline

Board footer

Powered by FluxBB