[cairo] non-ascii output

Evan Martin evan.martin at gmail.com
Wed May 18 15:48:47 PDT 2005

On 5/18/05, Bill Spitzak <spitzak at d2.com> wrote:
>         if (the_text_is_ascii) {
>                 foo_ascii(text);
>         } else {
>                 foo_utf8(text);
>         }

How is this different from:

if (the_text_is_big5) {  // a chinese encoding
  big5_code_path();  // probably convert to utf-8 then use below code
} else {

If your text is in a weird encoding, then different code paths are inevitable.

> The other possible solution by programmers is going to be:
>         foo_utf8(convert_my_stuff_to_utf8(text)).
> The problem with this is that "text" is not in UTF-8, thus we have done

Either it is in UTF8, and this convert call is unnecessary, or it's
not in UTF-8, and you need to know the encoding of the bytes
(ISO-8859-1, maybe?) to be able to do anything useful with them.

More information about the cairo mailing list