[Scummvm-devel] Using non-ascii characters in our source, and in filenames
Max Horn
max at quendi.de
Sun Mar 19 09:21:05 CET 2006
Am 17.03.2006 um 01:31 schrieb kirben at users.sourceforge.net:
> Revision: 21341
> Author: kirben
> Date: 2006-03-16 16:30:58 -0800 (Thu, 16 Mar 2006)
> ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21341&view=rev
>
> Log Message:
> -----------
> Add another German version of puttzoo demo
>
> Modified Paths:
> --------------
> scummvm/trunk/engines/scumm/scumm.cpp
> Modified: scummvm/trunk/engines/scumm/scumm.cpp
> ===================================================================
> --- scummvm/trunk/engines/scumm/scumm.cpp 2006-03-16 23:22:23 UTC
> (rev 21340)
> +++ scummvm/trunk/engines/scumm/scumm.cpp 2006-03-17 00:30:58 UTC
> (rev 21341)
> @@ -263,6 +263,7 @@
> { "putttime", "ZEITDEMO", kGenPC },
> { "puttzoo", "Puttzoo Demo", kGenMac },
> { "puttzoo", "PuttZoo", kGenMac },
> + { "puttzoo", "T\xF6ff-T\xF6ff\x99 Zoo Demo", kGenMac },
> { "puttzoo", "zoodemo", kGenPC },
> { "puttzoo", "Zoo Demo", kGenMac },
> { "SamsFunShop", "Sam's FunShop", kGenMac },
Hi Travis, hi all,
this change won't work well, I am afraid. (Note: The above diff is
misleading, look at the real one to see that non-ASCII chars are used
here: <http://svn.sourceforge.net/viewcvs.cgi/scummvm/scummvm/trunk/
engines/scumm/scumm.cpp?view=diff&r1=21340&r2=21341>).
First off, it turns scumm.cpp into a non-ASCII file, and thus will
cause confusion with editors that expect files to use a particular
encoding. Lots of bad things can happen because of this...
Secondly, an UTF-8 encoding is used for the name. But currently we do
not at all specify how to handle non-ASCII filenames in any of our
APIs. Hence that snippet above will work IF AND ONLY IF the
underlying file API (fopen, stat etc.) happens to use the UTF-8
encoding, too. Which may or may not be the case.
The first issue is easily resolved by doing the "right thing" -- by
encoding the offending characters using C-style escape sequences,
i.e. using octal or hexadecimal escape sequences. The above could be
rewritten as:
"T\xF6\xff-T\xF6\xff\x99 Zoo Demo"
The second issue is much harder to resolve. We could for example
demand that all our backends provide file system operations that use
a particular encoding (e.g. UTF-8). But that's probably not realistic
anyway. Right now, we managed fine, because paths/file names were
either pure ASCII, or were fixed to a single computer, so which
encoding was used was totally irrelevant.
Hence the alternative to requiring a fixed encoding is to ignore the
matter, and simply let Töff-Töff remain unsupported (at least, not
supported w/o manual work) on systems that use a different encoding.
Cheers,
Max
More information about the Scummvm-devel
mailing list