You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Brian Reynolds <le...@gmail.com> on 2010/05/26 15:48:26 UTC

Transcoding Help

 Hello All,

I have a problem when transcoding some content into ASCII using
XMLTranscoder::transcodeFrom. The string is about 1000 bytes long, and at
offset 966, there happens to be a non-ascii byte (0xED). I would of thought
that the transcodeFrom API would throw an exception and report this, but
unfortunately it does not.

When I dig a little deeper, I find that I'm using the
XMLASCIITranscoder::transcodeFrom to do the transcode. In the for loop of
this method there is a line

if (countDone > 32)
            break;

What is the purpose of *that ? *As I said above the invalid byte is at
offset 966, greater than 32, thus we break out of the loop, stop transcoding
and return. Why does the transcodeFrom method only report invalid bytes if
the size is greater than 32 ?

I'm currently using v2.8, but I've checked out the SVN trunk and the code is
the same. Can someone tell me

a. is this a bug ?
b. if it is not a bug, how should I handle this scenario in the  code that
calls transcodeFrom ? Is it safe to assume that if the bytesEaten is less
than the maxChars, then this kind of truncation has occurred ?

Thanks in advance.
Brian