# Encoding of window captions

**URL:** <https://discourse.libsdl.org/t/encoding-of-window-captions/13010>\
**Category:** SDL Development\
**Created:** [February 7, 2006, 1:47pm UTC](https://discourse.libsdl.org/t/encoding-of-window-captions/13010 "2006-02-07T13:47:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christoph\_Freundl](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/c/e480ec/32.png) [@Christoph\_Freundl](https://discourse.libsdl.org/u/Christoph_Freundl)\
**Post date:** [February 7, 2006, 1:47pm UTC](https://discourse.libsdl.org/t/encoding-of-window-captions/13010/1 "2006-02-07T13:47:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [February 7, 2006, 6:38pm UTC](https://discourse.libsdl.org/t/encoding-of-window-captions/13010/2 "2006-02-07T18:38:20Z")

</div>

> - 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. 🙂

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.

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [February 7, 2006, 6:47pm UTC](https://discourse.libsdl.org/t/encoding-of-window-captions/13010/3 "2006-02-07T18:47:30Z")

</div>

> > - 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. 🙂

> 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

```

---

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [February 7, 2006, 6:56pm UTC](https://discourse.libsdl.org/t/encoding-of-window-captions/13010/4 "2006-02-07T18:56:28Z")

</div>

> Ryan, you want to enter this into Bugzilla?

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

```

–ryan.
