SDL: Modified OSystem_SDL::setWindowCaption to strip out non-ASCII chars (this prevents a crash on OS X). Note that the OSystem specs cleary state that only ASCII may be passed to setWindowCaption(), but we ignore this e.g. in the launcher

svn-id: r40381
This commit is contained in:
Max Horn 2009-05-08 12:37:11 +00:00
parent 1c50778e46
commit c38c0980cd

View File

@ -396,7 +396,14 @@ Common::WriteStream *OSystem_SDL::createConfigWriteStream() {
}
void OSystem_SDL::setWindowCaption(const char *caption) {
SDL_WM_SetCaption(caption, caption);
Common::String cap(caption);
// 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());
}
bool OSystem_SDL::hasFeature(Feature f) {