if (mMimeType.EqualsIgnoreCase("text/plain")) {
if (mMimeType.LowerCaseEqualsLiteral("text/plain")) {
nsDocumentEncoder::EncodeToStream(nsIOutputStream* aStream){  nsresult rv = NS_OK;  if (!mDocument)    return NS_ERROR_NOT_INITIALIZED;  if (!mCharsetConverterManager) {    mCharsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);    NS_ENSURE_SUCCESS(rv, rv);  }  rv = mCharsetConverterManager->GetUnicodeEncoder(mCharset.get(),                                                   getter_AddRefs(mUnicodeEncoder));  NS_ENSURE_SUCCESS(rv, rv);  if (mMimeType.EqualsIgnoreCase("text/plain")) {    rv = mUnicodeEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nsnull, '?');    NS_ENSURE_SUCCESS(rv, rv);  }  mStream = aStream;  nsAutoString buf;  rv = EncodeToString(buf);  // Force a flush of the last chunk of data.  FlushText(buf, PR_TRUE);  mStream = nsnull;  mUnicodeEncoder = nsnull;  return rv;}