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–
_ http://wormsofprey.org
__ __ __ __ __ __ | __ __ ___
((( () | ’ | ) ) ) () | |) | ’ (/_ (|
The new and free real-time Worms game | |

  • in ANSI encoding (or Latin1?) on Windows: “\xF6”
  • in UTF-8 encoding on Mac OS X: “\xC3\xB6”

I just ran into this on Linux/MacOS too. Consider changing the name of
your program. :slight_smile:

I don’t think we make any promises about encoding, so UTF-8 would let us
keep backwards compatibility with all the 7-bit ASCII apps if we can
parse it inside SDL and give the Window Managers what they want.

The Mac branch already expects UTF-8 here anyhow.

–ryan.

  • in ANSI encoding (or Latin1?) on Windows: “\xF6”
  • in UTF-8 encoding on Mac OS X: “\xC3\xB6”

I just ran into this on Linux/MacOS too. Consider changing the name of
your program. :slight_smile:

I don’t think we make any promises about encoding, so UTF-8 would let us
keep backwards compatibility with all the 7-bit ASCII apps if we can
parse it inside SDL and give the Window Managers what they want.

The Mac branch already expects UTF-8 here anyhow.

SDL should use UTF-8 for all text string parameters and return values.
We’ll formalize this for 1.3, and include UTF-* conversion functions,
but in the meantime we can fix it so the window manager functions do
the right thing for 1.2.

Ryan, you want to enter this into Bugzilla?

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Ryan, you want to enter this into Bugzilla?

https://bugzilla.libsdl.org/show_bug.cgi?id=139

–ryan.