Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_WM_SetCaption() cannot handle Japanese(and maybe other languages) on Windows #255

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 1.2.11
Reported for operating system, platform: Windows (All), x86

Comments on the original bug report:

On 2006-11-17 07:06:16 +0000, aki. wrote:

Hello,

When Japanese is given to SDL_WM_SetCaption() on Windows, it garbles.

WinAPI receives string corresponding to the code page of the system.
Therefore, I think that it should use such as following codes instead of SDL_iconv_utf8_latin1():

char *SDL_iconv_utf8_acp(char *in) {
Uint16 *lpsz = SDL_iconv_utf8_ucs2(in);
size_t len = WideCharToMultiByte(CP_ACP, 0, lpsz, -1, NULL, 0, NULL, NULL);
char *out = SDL_malloc(len + 1);
WideCharToMultiByte(CP_ACP, 0, lpsz, -1, out, len, NULL, NULL);
SDL_free(lpsz);
return out;
}

Regards,
aki. (c@tqzh.tk)

On 2007-02-13 04:54:06 +0000, Ryan C. Gordon wrote:

Created attachment 189
Proposed patch to handle Unicode...

Here's a proposed patch...it is untested and may not even compile, yet.

It will see if SetWindowTextW() is available in kernel32.dll (as it will be on WinNT, WinXP, Win2000 and Vista), and if so, it feeds the ucs-2 string to it. This will allow, for example, Japanese characters to be used in the titlebar on a WinXP box that uses a Russian codepage.

If SetWindowsTextW() isn't available (Win95, Win98, WinME), then it will use WideCharToMultiByte(CP_ACP, ...) as originally proposed. This will not necessarily work everywhere, but it will probably work in most real life scenarios, and definitely better than assuming a latin1 codepage as we currently do.

If there are no objections, I'll commit this patch once I've had a chance to compile and test it on Windows.

--ryan.

On 2007-02-16 01:21:47 +0000, Ryan C. Gordon wrote:

Fixed in svn revision # 2985 for the 1.2 branch.

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant