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 139

Summary: SDL_WM_SetCaption() should handle UTF-8
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.0   
Hardware: x86   
OS: Linux   

Description Ryan C. Gordon 2006-02-07 13:56:01 UTC
From: Christoph Freundl <Scusi@wormsofprey.org>
To: sdl@libsdl.org
Date: Tue, 7 Feb 2006 14:47:02 +0100
Subject: [SDL] Encoding of window captions

Hi,

seeing that there is a discussion about the encoding of Unicode input 
messages, I would like to address a slightly related issue regarding 
the encoding of window captions for the function SDL_WM_SetCaption().

I have problems with the display of special characters in window 
captions. For example, if I like to display the German umlaut "o (o 
diaeresis) I have to write it
- in ANSI encoding (or Latin1?) on Windows: "\xF6"
- in UTF-8 encoding on Mac OS X: "\xC3\xB6"
On Linux I could not figure out a way which works reliably. Sometimes 
it works if I write the "o as plain text in the sourcecode, sometimes 
the UTF-8 encoding looks promising, but it is also possible that I 
cannot get it to work at all. From a glance at the SDL sources I see 
that it depends whether the library has been compiled with Unicode 
support in X (macro X_HAVE_UTF8_STRING) but I can see no way how to 
figure that out in my program. It also seems to me that the used 
windowmanager influences the result.

I can imagine two possible solutions for this: either, the API is 
changed such that the caption for SDL_WM_SetCaption() is always in a 
fixed encoding (maybe UTF-8?), but then of course recoding the string 
on systems that do not support UTF-8 captions is necessary. Or, there 
is a function which can tell at runtime the required encoding of 
caption strings.

Well, the display of special characters in window captions is probably 
also a special problem that occurs not very often, but I am interested 
if there is a way to solve my problem.

Regards, Christoph
Comment 1 Sam Lantinga 2006-03-12 20:35:19 UTC
SDL_WM_SetCaption() now takes UTF-8 strings (in CVS)

Please let me know if there are any problems! :)