[cairo] Surface error not set when using cairo_show_text() with invalid utf8

Maarten Bosmans mkbosmans at gmail.com
Tue Nov 2 14:53:02 PDT 2010


2010/11/2 Bill Spitzak <spitzak at gmail.com>:
>
>
> Maarten Bosmans wrote:
>>
>> 2010/11/2 Bill Spitzak <spitzak at gmail.com>:
>>>
>>> PLEASE do not make UTF-8 errors stop any output!
>>>
>>> A lot of deluded systems engineers think doing this will "force people to
>>> use Unicode correctly". But it does not, in fact it does the exact
>>> opposite!
>>
>> The fact that people, upon misusing cairo api by feeding it non-UTF-8
>> encoded data, do not resolve the problem properly, but resort to the
>> kind of ugly hacks you mention below, can hardly be blamed on the
>> "deluded system engineers" that made the supporting libraries.
>
> This is EXACTLY the deluded impression.
>
> If the programmer is forced to write code, when a simple and obvious change
> to the API would mean they could write NO code, then I think any "hacks" in
> that code *are* the engineer's fault, because a correct API would mean the
> hacks would not exist. Trying to pass blame for this is a disease that is
> pretty bad in Linux and open source, and I would like to see it stop!

It is the principle of failing fast. This way errors are not swept
under the rug, but are painfully obvious. I fear that with your
proposal bad string handling gets unnoticed by the developer, leading
to more faulty applications.

Failing fast gives the developer an opportunity to fix the problem. I
mean, we're talking about programmers here, not end users. They can
handle a line or two in the source code when your proposed behaviour
is preferred.

Maarten


More information about the cairo mailing list