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 Nick <no...@codesniffer.com> on 2013/01/09 03:45:09 UTC

Re: Unable to transcode single LF to UTF-32

Anyone run into this issue or have any thoughts on it?


On Sun, 2012-12-30 at 11:29 -0500, Nick wrote:

> I seem to be getting an error when I attempt to transcode a single Line
> Feed (0x0A) from Xerces' format (XMLCh*) to UTF-32 using TranscodeToStr.
> 
> This was initiated from an XML file as I was converting the text nodes.
> 
> Here's a boiled-down example:
> 
> 	XMLCh pStr[2] = {10, 0};
> 	xercesc::TranscodeToStr transcoder(pStr, "UTF-32");
> 
> Attempting to create the transcoder results in an exception with
> message:  "invalid multi-byte sequence".
> 
> Attempting the same thing with either different or additional input
> works:
> 	XMLCh pStr[3] = {10, 10, 0};
> 	xercesc::TranscodeToStr transcoder(pStr, "UTF-32");
> 
> Attempting the same thing with a different output encoding also works.
> 	XMLCh pStr[2] = {10, 0};
> 	xercesc::TranscodeToStr transcoder(pStr, "UTF-8");
> 
> I'm using the latest version of Xerces-c (3.1.1), compiled from source
> using GCC 4.5.4 and with ICU 50.1.1, on Linux.
> 
> Thoughts or suggestions?
> 
> Best regards,
> Nick
> 
>