How can I use multi-byte characters in game title?

Hello every one!
(I’m not good at English because I’'m Japanese…)
I want to use Japanese character in game title.
(Game Project)
image

On debugging, it is not garbled.
image

But on executable file (.exe) , it is garbled.
image

How can I use multi-byte characters in game title?
Please give me some solutions!! :smiley:

1 Like

I’m not very familiar with Windows so I can’t say for sure what’s wrong. @Pkeod do you have any experience with this?

2 Likes

Could you test setting the game’s Window title with DefOS and see if it makes a difference?

2 Likes

Thank you for your reply!

I tried to use “defos”, but it is still garbled.
image

P.S. I want to use multi-byte characters not only in title bar but also in Android App name.

Is it depending on Defold system?
If so, I should wait for update! :stuck_out_tongue:

I believe we’ve had problems with non ascii characters in Android app names, but I think we solved it. @jhonny.goransson and @AGulev does that ring a bell?

1 Like

Here’s the code for the DefOS version. I encourage you to search online for a possible solution and try to experiment on how it can be changed to work properly. Then contribute the improvement. :slight_smile:

@ChaosYu @dapetcu21

3 Likes

Thanks!
I will try in various ways. :smiley:

1 Like

I encountered this issue and I think I found a way to solve this. I added “CP_UTF8” to CA2W call and now my window title can show é in the title when it is set through DefOS.

void defos_set_window_title(const char *title_lua)
{
    SetWindowTextW(dmGraphics::GetNativeWindowsHWND(), CA2W(title_lua, CP_UTF8));
}

Hmm, I thought this was solved already? @Pkeod ?

SetWindowTextW(dmGraphics::GetNativeWindowsHWND(), CA2W(title_lua));

Was the way it was done before it was fixed but without the CP_UTF8 parameter, which sounds like it should have been there.

This is what it is now

    wchar_t unicode_title[MAX_WINDOW_TITLE_LENGTH];
    int res = MultiByteToWideChar(CP_UTF8, 0, title_lua, -1, unicode_title, MAX_WINDOW_TITLE_LENGTH);
    if (res <= 0)
    {
        unicode_title[0] = 0;
    }
    SetWindowTextW(dmGraphics::GetNativeWindowsHWND(), unicode_title);

@Hasan_Khan can you confirm you were using the latest version of DefOS / this version of it wasn’t working for you?

1 Like