We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2971 - MessageBox title does not support UTF-8 on X11
Summary: MessageBox title does not support UTF-8 on X11
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-01 11:16 UTC by Jason Wyatt
Modified: 2017-08-13 19:19 UTC (History)
2 users (show)

See Also:


Attachments
Patch to fix corrupt UTF-8 messagebox titles. (1.59 KB, patch)
2015-05-05 08:21 UTC, Jason Wyatt
Details | Diff
Screenshot of reproduced bug at revision a15188ff9537, Linux Mint 18.1 (6.26 KB, image/png)
2017-02-02 10:24 UTC, Vitaly Novichkov
Details
A demo which reproduces this bug (301 bytes, text/x-csrc)
2017-02-02 10:40 UTC, Vitaly Novichkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Wyatt 2015-05-01 11:16:48 UTC
It looks like SDL currently sets the window title via XStoreName. According to the docs, "If the string is not in the Host Portable Character Encoding, the result is implementation dependent.". Atleast on KDE, this seems to mean that it doesn't support UTF8.

Possibly SDL should be setting _NET_WM_NAME instead/as well. This does take a UTF8 string, and seems to work on KDE.
Comment 1 Sam Lantinga 2015-05-03 02:26:28 UTC
Can you provide a tested patch?

Thanks!
Comment 2 Jason Wyatt 2015-05-05 08:21:28 UTC
Created attachment 2149 [details]
Patch to fix corrupt UTF-8 messagebox titles.

Tested on KDE. I haven't had a chance to test this elsewhere (hopefully using both methods should give a wider coverage though).
Comment 3 Ryan C. Gordon 2015-05-31 06:10:44 UTC
This patch looks reasonable, tagging this with target-2.0.4 so I remember to try it on a Linux machine soon.

--ryan.
Comment 4 Ryan C. Gordon 2015-06-01 04:05:32 UTC
Your patch is now https://hg.libsdl.org/SDL/rev/bf0257e323d2, thanks!

--ryan.
Comment 5 Vitaly Novichkov 2017-02-02 10:22:54 UTC
I having latest revision a15188ff9537 and still has issue (seems text are like ANSI). All my source codes are in UTF8 format and titles / contents are have been passed through translator which returns UTF8 strings. Screenshot will be added.
Comment 6 Vitaly Novichkov 2017-02-02 10:24:22 UTC
Created attachment 2693 [details]
Screenshot of reproduced bug at revision a15188ff9537, Linux Mint 18.1
Comment 7 Vitaly Novichkov 2017-02-02 10:40:06 UTC
Created attachment 2694 [details]
A demo which reproduces this bug
Comment 8 Ryan C. Gordon 2017-08-13 04:05:22 UTC
Downloading a copy of Linux Mint.

--ryan.
Comment 9 Ryan C. Gordon 2017-08-13 04:09:56 UTC
(In reply to Ryan C. Gordon from comment #8)
> Downloading a copy of Linux Mint.

(To be clear: I tried this on a default install of Ubuntu 17.04 and it works correctly, but that doesn't mean much.)

--ryan.
Comment 10 Ryan C. Gordon 2017-08-13 04:39:32 UTC
> (To be clear: I tried this on a default install of Ubuntu 17.04 and it works
> correctly, but that doesn't mean much.)

Definitely broken on Mint 18.2 (Cinnamon)...it's worth noting that SDL_CreateWindow() works with a Unicode titlebar here, so this is probably easy to fix by comparing these two codepaths.

--ryan.
Comment 11 Ryan C. Gordon 2017-08-13 05:02:07 UTC
> Definitely broken on Mint 18.2 (Cinnamon)...it's worth noting that
> SDL_CreateWindow() works with a Unicode titlebar here, so this is probably
> easy to fix by comparing these two codepaths.

Fixed in https://hg.libsdl.org/SDL/rev/931e9d3a452e, and patched to compile in https://hg.libsdl.org/SDL/rev/f7abcb63e51e

--ryan.
Comment 12 Vitaly Novichkov 2017-08-13 16:24:45 UTC
Thanks for the fix, now everything works fine! :D
The one question is left that non-ASCII letters are looking too big... But good that there are shown readable rather junk characters.
Comment 13 Ryan C. Gordon 2017-08-13 19:19:39 UTC
> The one question is left that non-ASCII letters are looking too big

I think you'd have to take that up with the window manager's code: it decides what font it wants to use here, not us.

--ryan.