<<If this question is better posted on Ubuntu or Superuser sites, please let me know.>>
I am building a Windows application on Debian Linux (stable) that runs with Wine.
To begin, I wrote a very simple "Hello, World!" application. It works very well for an English caption and text. However, if I add Japanese text to the caption and text, only the caption correctly displays the Japanese text. The text inside the Windows message box uses Unicode substitution characters (empty rectangles). I Google'd so hard, but I cannot find the answer to this issue. :(
My simple C source code:
/* Working with Strings: https://learn.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings */
/* Ref: https://stackoverflow.com/questions/7424383/what-is-the-difference-between-the-a-and-w-functions-in-the-win32-api */
/* Ref: https://stackoverflow.com/questions/4143110/what-encoding-win32-api-functions-expect */
#define UNICODE 1
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
/* Ref: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox */
MessageBoxW(NULL, /* [in, optional] HWND hWnd */
TEXT("Hello, world! ようこそ東京!"), /* [in, optional] LPCTSTR lpText */
TEXT("ようこそ東京 | This is a MessageBox title"), /* [in, optional] LPCTSTR lpCaption */
MB_OK | MB_ICONINFORMATION); /* [in] UINT uType */
return 0;
}
I compile this code as: $ x86_64-w64-mingw32-gcc -o ./hello-world.exe ./hello-world.c
I run this code as: $ wine ./hello-world.exe
Output looks like this:
The caption displays correctly, but the message box text does not.
My locale looks like this:
$ locale
LANG=en_HK.UTF-8
LANGUAGE=en_HK:en
LC_CTYPE="en_HK.UTF-8"
LC_NUMERIC="en_HK.UTF-8"
LC_TIME="en_HK.UTF-8"
LC_COLLATE="en_HK.UTF-8"
LC_MONETARY="en_HK.UTF-8"
LC_MESSAGES="en_HK.UTF-8"
LC_PAPER="en_HK.UTF-8"
LC_NAME="en_HK.UTF-8"
LC_ADDRESS="en_HK.UTF-8"
LC_TELEPHONE="en_HK.UTF-8"
LC_MEASUREMENT="en_HK.UTF-8"
LC_IDENTIFICATION="en_HK.UTF-8"
LC_ALL=
I also tried this command, but no improvement: $ LC_ALL=ja_JP.UTF-8 wine ./hello-world.exe
What is the trick to make this work? I assume it is: (a) a missing #define
, (b) a missing Debian package, (c) a missing environment variable.
Related question: Would my sample code work on native Win 7 or Win 10?
I also tried:
winetricks allfonts
but no improvement.