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

Theo Veenker T.J.G.Veenker at uu.nl
Thu Nov 4 01:47:35 PDT 2010


Bill Spitzak wrote:
> 
> 
> Behdad Esfahbod wrote:
>> On 11/02/10 23:54, cu wrote:
>>> But with current behavior programmer (me) doesn't get a chance to fix
>>> the error! First of all it is not even set correctly (that's a *bug* and
>>> it needs to be fixed) - so as a programmer I don't even get notified of
>>> an error. The only way I see that there was an error is because my cairo
>>> image is half-empty!
>>
>> You are supposed to check *before* calling cairo.  Many programmers /
>> applications for example always check text for validity at the point 
>> that it
>> enters their module.  Cairo does so.  You should do so too.
> 
> I'm sorry but that is just a load of B***. Any "check" can be run 
> WHETHER OR NOT the API will draw it. If the intentions is "get as much 
> of this text as possible onto the screen so the user can figure out what 
> is going on" then this API is useless, and no "check" is going to help.
> 
> Stop making excuses for an API that is obviously not doing what is 
> needed and FIX

I agree. Replacing ill-formed code units by replacement characters would
be the only sane thing to do IMO. I'm afraid the rationale for just bombing
out on error instead of doing the substitution is that it is too much work
to fix; maybe I'm wrong.

I'm dreaming of a new world where UTF-32 is the only allowed encoding scheme.

Theo


More information about the cairo mailing list