[cairo] Unicode error causing Cairo to crash.

Bill Spitzak spitzak at d2.com
Wed Apr 27 13:26:45 PDT 2005



Jason Dorje Short wrote:

> I do think taking ONLY utf-8 strings is a bad idea.  I haven't looked at
> the cairo API here but UCS-2 and (especially) UCS-4 are theoretically
> better than UTF-8 and it would be a shame to make someone convert from
> these encodings into UTF-8, only to have the cairo implementation
> convert BACK into unicode to do glyph lookups.

UCS-2 is obsolete and should never be used or specified. UTF-16 is what 
Windows uses, but it is a very bad idea, because of the "surrogate" 
character pairs. This makes it just as difficult to use as UTF-8, while 
losing the ASCII compatability. And because the surrogate pairs are 
encountered far less often than multibyte UTF-8, they are much less 
likely to be correctly debugged. Therefore I would prefer to not see any 
16-bit interface in order to discourage it's use.

Cairo does provide a 32-bit/glyph interface that is compatable with 
UCS-4 or UTF-32. However I think it may be a good idea to use the high 
bits as a system-font identifier, allowing an interface like Pango to 
avoid font-switching to get all the glyphs it wants. So it may be a bad 
idea to call it UTF-32 or UCS-4.



More information about the cairo mailing list