[haiku-development] Re: Font Encoding

  • From: pulkomandy <pulkomandy@xxxxxxxxxxxxxxxxx>
  • To: <haiku-development@xxxxxxxxxxxxx>
  • Date: Wed, 16 Feb 2011 09:51:02 +0100

On Wed, 16 Feb 2011 09:30:46 +0100, Michael Pfeiffer
<michael.w.pfeiffer@xxxxxxxxx> wrote:
> Am 16.02.2011 um 09:05 schrieb pulkomandy:
> 
>> So, let's keep it around for the gcc2 version, but a better API should
be
>> made.
> 
> What do you mean with better API? As far as I can tell it works fine,
> just our implementation is broken.

No, the API design is broken. It is NOT possible to perform streamed
conversions with it.
You need to send it a whole text and get the full result at once. This is
because if you want to split the text in multiple chunks, you _have_ to
keep a context to connect between them. This may not be a too big problem
in converting iso-8859<>utf-8 (unless you cut your chunk inside a multibyte
utf8 char), but it is much more annoying when working with utf-16 or utf-7,
because each chunk gets a begin and end marker, whereas there should be
only one at the very beginning and the very end of the file.

> 
>> Unless you have a way to fix the existing one.
> 
> Maybe drop ICU and implement it our own?

Currently iconv is used. ICU works the same way (with a context). It is
NOT possible to do it otherwise with a solution that works in all these
cases.
So keep the API for what's its used for now, knowing that it's needlessly
slow and limited. And add a better one for future use, that will actually
work in all cases and faster, without being much more complex, and will
also fit better the Be API world, C++ style.

If you can implement it in a wa that works in all case, we'll accept the
patch. But I know I can't do it without a context token for utf-7 or
utf-16.

-- 
Adrien.

Other related posts: