Don't convert charset on nsStrings, as suggested in comments in bug 6672

git-svn-id: svn://10.0.0.236/trunk@42532 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
akkana%netscape.com
1999-08-06 20:50:37 +00:00
parent 37f8661b4a
commit ccf4e538ba
2 changed files with 28 additions and 42 deletions

View File

@@ -510,34 +510,27 @@ void nsHTMLContentSinkStream::EncodeToBuffer(const nsString& aSrc)
void nsHTMLContentSinkStream::Write(const nsString& aString)
{
// No need to re-encode strings, since they're going from UCS2 to UCS2
if (mString != nsnull)
mString->Append(aString);
if (!mStream)
return;
// Now handle the stream case:
nsOutputStream out(mStream);
// If a encoder is being used then convert first convert the input string
if (mUnicodeEncoder != nsnull)
if (mUnicodeEncoder)
{
EncodeToBuffer(aString);
if (mStream != nsnull)
{
nsOutputStream out(mStream);
out.write(mBuffer,mBufferLength);
}
if (mString != nsnull)
{
mString->Append(mBuffer);
}
out.write(mBuffer, mBufferLength);
}
// else just write the unicode
else
{
if (mStream != nsnull)
{
nsOutputStream out(mStream);
const PRUnichar* unicode = aString.GetUnicode();
PRUint32 length = aString.Length();
out.write(unicode,length);
}
else
{
mString->Append(aString);
}
const PRUnichar* unicode = aString.GetUnicode();
out.write(unicode, aString.Length());
}
}