Changed to call Finish() after the conversion, bug 29652 , r=cata.

This commit is contained in:
nhotta%netscape.com 2000-03-15 23:38:27 +00:00
Родитель da4409bc12
Коммит 510ae4b294
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -203,8 +203,14 @@ nsSaveAsCharset::DoCharsetConversion(const PRUnichar *inString, char **outString
saveResult = rv;
rv = NS_OK;
// reset the encoder, estimate target length again
mEncoder->Reset();
// finish encoder, give it a chance to write extra data like escape sequences
dstLength = bufferLength - pos2;
rv = mEncoder->Finish(&dstPtr[pos2], &dstLength);
if (NS_SUCCEEDED(rv)) {
pos2 += dstLength;
dstPtr[pos2] = '\0';
}
srcLength = inStringLength - pos1;
// do the fallback