nsAutoString aAlias; aAlias.AssignWithConversion(aCharset);
nsAutoString aAlias; aAlias.AssignWithConversion(aCharset.get());
nsresult nsMsgI18NConvertToUnicode(const nsCString& aCharset,                                    const nsCString& inString,                                    nsString& outString){  if (inString.IsEmpty()) {    outString.Truncate();    return NS_OK;  }  else if (aCharset.IsEmpty() ||      aCharset.EqualsIgnoreCase("us-ascii") ||      aCharset.EqualsIgnoreCase("ISO-8859-1")) {    outString.AssignWithConversion(inString);    return NS_OK;  }  nsAutoString convCharset;  nsresult res;  // Resolve charset alias  nsCOMPtr <nsICharsetAlias> calias = do_GetService(NS_CHARSETALIAS_CONTRACTID, &res);  if (NS_SUCCEEDED(res)) {    nsAutoString aAlias; aAlias.AssignWithConversion(aCharset);    if (aAlias.Length()) {      res = calias->GetPreferred(aAlias, convCharset);    }  }  if (NS_FAILED(res)) {    return res;  }  nsCOMPtr <nsICharsetConverterManager> ccm = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);  if(NS_SUCCEEDED(res)) {    nsCOMPtr <nsIUnicodeDecoder> decoder;    // get an unicode converter    res = ccm->GetUnicodeDecoder(&convCharset, getter_AddRefs(decoder));    if(NS_SUCCEEDED(res)) {      const char *originalSrcPtr = inString.get();      char *currentSrcPtr = NS_CONST_CAST(char *, originalSrcPtr);      PRInt32 originalLength = inString.Length();      PRInt32 srcLength;      PRInt32 dstLength;      PRUnichar localbuf[512];      PRInt32 consumedLen = 0;      outString.AssignWithConversion("");      // convert      while (consumedLen < originalLength) {        srcLength = originalLength - consumedLen;          dstLength = 512;        res = decoder->Convert(currentSrcPtr, &srcLength, localbuf, &dstLength);        if (NS_FAILED(res) || dstLength == 0)          break;        outString.Append(localbuf, dstLength);        currentSrcPtr += srcLength;        consumedLen = currentSrcPtr - originalSrcPtr; // src length used so far      }    }      }    return res;}