Re: Expat occasionaly cropping multibyte character strings

Karl Waclawek <[email protected]> Sat, 15 May 2010 11:43:24 -0400
Newsgroups gmane.text.xml.expat.bugs
Message-ID <[email protected]>
On 15/05/2010 7:30 AM, Juraj Ivančić wrote:
> Expat does not handle multibyte characters correctly.
> Steps to reproduce this behaviour:
>
> 1) You need an input XML in e.g. UTF8 encoding which
> contains some multibyte characters (e.g. cyrillic characters)
>
> 2) Create an XML parser and feed it input file, but ensure
> that buffer breaks somewhere in the middle of a multibyte string.
> (To make sure - feed the parser one byte at a time).
>
> Say input file contains:
> '... <element>Соме валуе</element> ...'
>
> and it gets buffered like this:
>
> Buffer1: '... <element>Соме '
> Buffer2: 'валуе</element> ...'
>
> Expat parser will, when completing parsing Buffer1, invoke character
> data handler containing only partial ('Соме ') data, instead of waiting
> for the rest of the input. I think this is a bug as it only manifests
> when multibyte characters appear.

the way you describe it it is not a bug. Expat does not guarantee 
reporting the text between element tags as one string.
It would be a bug if Expat broke a single multi-byte character up into 
one or more parts.

Karl

_______________________________________________
Expat-bugs mailing list
[email protected]
http://mail.libexpat.org/mailman/listinfo/expat-bugs
karl.vcf (text/x-vcard, 180 B)
begin:vcard
fn:Karl Waclawek
n:Waclawek;Karl
email;internet:[email protected]
title:Solution Architect
tel;home:905-579-3443
tel;cell:289-600-6678
version:2.1
end:vcard