diff options
author | Max Horn | 2009-06-28 19:58:11 +0000 |
---|---|---|
committer | Max Horn | 2009-06-28 19:58:11 +0000 |
commit | bb28ed7b7a10535c4f3f275b3bef3643f9ce46d3 (patch) | |
tree | 821b47e102fe11e6f0a1801271a3e7decd60e81b /backends/platform/sdl | |
parent | a882a6f46779768f15d38e350781785d975e5007 (diff) | |
download | scummvm-rg350-bb28ed7b7a10535c4f3f275b3bef3643f9ce46d3.tar.gz scummvm-rg350-bb28ed7b7a10535c4f3f275b3bef3643f9ce46d3.tar.bz2 scummvm-rg350-bb28ed7b7a10535c4f3f275b3bef3643f9ce46d3.zip |
Changed OSystem::setWindowCaption to expect ISO LATIN 1 encoded input;
also intentionally broke WinCE and Symbian ports (in an obvious way that
can be undo by commenting out some text) -- hopefully this will get the
maintainers' attention during the next release cycle, unlike my emails
svn-id: r41932
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index c11c97c041..af6d350688 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -391,13 +391,20 @@ Common::WriteStream *OSystem_SDL::createConfigWriteStream() { } void OSystem_SDL::setWindowCaption(const char *caption) { - Common::String cap(caption); + Common::String cap; + byte c; + + // The string caption is supposed to be in LATIN-1 encoding. + // SDL expects UTF-8. So we perform the conversion here. + while ((c = *(const byte *)caption++)) { + if (c < 0x80) + cap += c; + else { + cap += 0xc0 | (c >> 6); + cap += 0x80 | (c & 0x3F); + } + } - // Filter out any non-ASCII characters, replacing them by question marks. - // At some point, we may wish to allow LATIN 1 or UTF-8. - for (uint i = 0; i < cap.size(); ++i) - if ((byte)cap[i] > 0x7F) - cap.setChar('?', i); SDL_WM_SetCaption(cap.c_str(), cap.c_str()); } |