Re: [xml] xmlOutputBufferWrite not working with an encoder that is not UTF-8

On Wed, Jul 11, 2007 at 01:28:51PM -0400, Daniel Veillard wrote:
On Wed, Jul 11, 2007 at 07:01:33PM +0200, Frank Gross wrote:

   I was using libxml xmlOutputBufferWrite function, but I found out 
that when the encoder is not UTF-8, the function doesn't work. I wrote 
my own function similar to libxml's one, excepted that I removed the 
following two lines of code:

  /*   if ((out->buffer->use < MINLEN) && (chunk == len)) goto done; */


  /* if ((nbchars < MINLEN) && (len <= 0)) goto done; */

Without those two lines, the function works well even if encoder is not 

Can someone tell me why these goto instructions are needed ? Or if I 
missed something ?

  You missed that running the encoder is costly, and doing it by large chunk
is way more efficient than piece by piece. Oh you also missed the Flush
and Close operations, i.e. you didn't took the time to understand how the
code worked I guess.

  Hum, that was a bit harsh, sorry !
Still I think what you missed is xmlOutputBufferFlush()


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]