1. detect BOM, 2. Implement XML 1.0 Appendex F, 3. move hack from nsParser.cpp to nsScanner.cpp so we won't damage UCS2 data

git-svn-id: svn://10.0.0.236/trunk@45206 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ftang%netscape.com
1999-08-30 22:25:17 +00:00
parent 003e325792
commit 83734eae50
4 changed files with 272 additions and 2 deletions

View File

@@ -257,6 +257,16 @@ PRBool nsScanner::Append(const char* aBuffer, PRUint32 aLen){
PRInt32 unicharLength = unicharBufLen;
res = mUnicodeDecoder->Convert(unichars, 0, &unicharLength,aBuffer, 0, &srcLength );
unichars[unicharLength]=0; //add this since the unicode converters can't be trusted to do so.
// Move the nsParser.cpp 00 -> space hack to here so
// it won't break UCS2 file
// Hack Start
for(PRInt32 i=0;i<unicharLength;i++)
if(0x0000 == unichars[i])
unichars[i] = 0x0020;
// Hack End
mBuffer.Append(unichars, unicharLength);
mTotalRead += unicharLength;
// if we failed, we consume one byte by replace it with U+FFFD