peiyongz 2003/01/28 10:32:54 Modified: c/src/xercesc/internal XMLReader.cpp Log: Bug#13694: Allow Xerces to write the BOM to XML files Revision Changes Path 1.12 +11 -1 xml-xerces/c/src/xercesc/internal/XMLReader.cpp Index: XMLReader.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLReader.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- XMLReader.cpp 20 Dec 2002 22:09:56 -0000 1.11 +++ XMLReader.cpp 28 Jan 2003 18:32:53 -0000 1.12 @@ -1284,6 +1284,16 @@ case XMLRecognizer::UCS_4B : case XMLRecognizer::UCS_4L : { + // Remove bom if any + if (((fRawByteBuf[0] == 0x00) && (fRawByteBuf[1] == 0x00) && (fRawByteBuf[2] == 0xFE) && (fRawByteBuf[3] == 0xFF)) || + ((fRawByteBuf[0] == 0xFF) && (fRawByteBuf[1] == 0xFE) && (fRawByteBuf[2] == 0x00) && (fRawByteBuf[3] == 0x00)) ) + { + for (unsigned int i = 0; i < fRawBytesAvail; i++) + fRawByteBuf[i] = fRawByteBuf[i+4]; + + fRawBytesAvail -=4; + } + // Look at the raw buffer as UCS4 chars const UCS4Ch* asUCS = (const UCS4Ch*)fRawByteBuf;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]