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

Bill Spitzak spitzak at gmail.com
Tue Nov 2 15:29:12 PDT 2010


Maarten Bosmans wrote:

> 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.

You might want to look at my original post. I said something like "the 
delusion that this will somehow force the user to use Unicode 
correctly". You could not have worded exactly what I am saying more 
accurately!

Now if Cairo's printing function could somehow magically detect (maybe 
using a spelling corrector?) that the string has been mangled to remove 
UTF-8 encoded characters, then error detection would work.

However you have to realize that to the programmer, the error is "the 
end of my string got truncated after a byte with the high bit set and 
nothing else was drawn". The "fix" is "remove the byte with the high bit 
set". The result: the end of the string is drawn. No error from Cairo, 
so according to you this is proof that the fix is perfect! And we are 
one more step further in making I18N a complete joke on Linux. Thank you 
very much!



More information about the cairo mailing list