[Scummvm-devel] PORTERS: OSystem::setWindowCaption

Max Horn max at quendi.de
Sun Jun 7 17:53:21 CEST 2009


Hi everybody,

OSystem::setWindowCaption is documented to expect pure ASCII strings  
(i.e. all chars < 128). T

Bad part: Our frontend code violates this and may pass non-ASCII  
strings to setWindowCaption. See also <https://sourceforge.net/tracker/index.php?func=detail&aid=2167477&group_id=37116&atid=418822 
 >.

The SDL backend used to have a problem because of that: It passed the  
string in encoding A unmodified to the OS, which might expect encoding  
B, which in the worst case could lead to a crash.  As a quick  
workaround, I modified the SDL backend some time ago to handle non- 
ASCII strings (by replacing all non-ascii chars with a question mark).

This leaves two related questions / tasks:

   1) Should we switch from pure ASCII to say ISO LATIN 1 or UTF-8?
   1b) UTF-8 or LATIN 1? :) The former is more flexible, but also more  
complex... LATIN 1, can easily be converted into it, though...

   2) Anything calling setWindowCaption should be modified to ensure  
it only passes valid data.


My vote goes for switching setWindowCaption() to UTF-8 at this time,  
but feel free to convince me otherwise :). At least on OS X and  
Windows, I think both should be no major issue. The only non-SDL ports  
which implement a non-trivial setWindowCaption() are the Palm and the  
DC port. For the palm port, *if* it gets revived one day (Chrilith), I  
think UTF-8 would be feasible (in the worst case, it could just strip  
non-ASCII chars and would not be in a worse condition than it  
currently is).

For the DC port.. well I am confused by that. It seems to do only one  
thing with the window caption: Namely, store it into any subsequent  
save states. Hu? Maybe this is somehow used elsewhere to display a  
game name together with each save? Marcus?


Bye,
Max




More information about the Scummvm-devel mailing list