Re: [xml] xmlOutputBufferWrite not working with an encoder that is not UTF-8
- From: Daniel Veillard <veillard redhat com>
- To: Frank Gross <fg 4js com>
- Cc: xml gnome org
- Subject: Re: [xml] xmlOutputBufferWrite not working with an encoder that is not UTF-8
- Date: Wed, 11 Jul 2007 13:28:51 -0400
On Wed, Jul 11, 2007 at 07:01:33PM +0200, Frank Gross wrote:
Hi,
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; */
and
/* if ((nbchars < MINLEN) && (len <= 0)) goto done; */
Without those two lines, the function works well even if encoder is not
UTF-8.
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.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]