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

cu cairouser at yahoo.com
Tue Nov 2 14:32:57 PDT 2010

Bill Spitzak wrote:
> Maarten Bosmans wrote:
>> Why wouldn't one use any of the existing validation/conversion routines?
>> http://library.gnome.org/devel/glib/2.26/glib-Unicode-Manipulation.html
> Yes a programmer can call this if they want to detect errors. That has
> nothing to do with the problem. Maybe if we are really, really, really
> lucky, the programmer might call a useful function that preserves
> UTF-8 (but there is no "convert this UTF-8 to the closest possible
> valid form" call in that library so I am afraid it will not happen).
:) Why use this when cairo has it's very own utf8 check which
1) may or may not be the same as this one
2) does not require getting the entire glib and gnome in for something
so small
3) is a double work, because that function in cairo is going to be
called in about 10 more instructions

Why do you need to have something in cairo to validate utf8 if it is
expected that a caller has to do so? It really should be one or the other.

> Let me make another suggestion: lets add a "set the cairo error if
> there is an error in this UTF-8" function, and fix the drawing like I
> suggest. Then the users who want the current behavior can do these two
> calls.
FWIW this sounds like a good idea.

More information about the cairo mailing list