[cairo] [PATCH] script: More compatible with C89 and VC++.

Tor Lillqvist tml at iki.fi
Sat Jun 26 01:43:57 PDT 2010

> Isn't there a way to force the "system code page" to be UTF-8?

Unfortunately, no. That would be great, but I assume it would break a
lot of existing code which has been able to assume that the system
codepage is either a single-byte one like codepage 1252 (i.e.
ISO-8859-1 basically), or a double-byte one like codepage 936. Such
code would break if the system codepage would be a multi-byte one.

Microsoft's policy, as far as I can deduce, is that one should just
use Unicode and forget code pages.

(Yeah, I know in their case Unicode generally means UTF-16, which of
course with hindsight is quite silly with its need for surrogate
pairs, and either just using full 32-bit unicode chars, or UTF-8, as
we typically do in the open source world, is saner. But then, not even
Java managed to avoid UTF-16 even if surely the writing on the wall
was clear back then?)

Now, how widely used is this basename() in fact in cairo then? I don't
remember ever coming across it when building cairo on Windows. Is it
used only by some helper program that is not necessarily needed when
building cairo?

(OK, so I should just frigging look in the source... /me git pulls...
Yeah, that seems to be the case, all this fuss just over just some
test programs.)

> Also quite a few cairo API's assume the text
> is UTF-8 so it is silly to pretend that other encodings can exist.

For text (not filenames), assuming UTF-8 is definitely the right thing, IMHO.

> If there is a UTF-8 error in the string, I
> expect basename to return a string with the same error in it,

But in the cairo test code case, basename() will be called on
filenames originating from the command line, no?

I think, for the case of cairo performance test programs, we should
just explicitly verify that the command line arguments are ASCII


More information about the cairo mailing list