opt->stream_closure, (useInputCharsetConverter) ? opt->m_inputCharsetToUnicodeDecoder : nsnull, opt->m_unicodeToUTF8Encoder);
opt->stream_closure, opt->m_inputCharsetToUnicodeDecoder , opt->m_unicodeToUTF8Encoder); else status = opt->rfc1522_conversion_fn(input, input_length, inputCharset, output_charset,   &converted, &converted_len, opt->stream_closure, nsnull , opt->m_unicodeToUTF8Encoder);
MimeHeaders_convert_rfc1522(MimeDisplayOptions *opt,							const char *input, PRInt32 input_length,							char **output_ret, PRInt32 *output_length_ret){  *output_ret = 0;  *output_length_ret = 0;  if (input && *input && opt && opt->rfc1522_conversion_fn)	{	  char *converted = 0;	  PRInt32 converted_len = 0;    const char *output_charset = nsnull;    // Ok, here is where we need to check for the type    // of output that we are doing. If we are doing Save As output    // then we should convert to the charset that lives in the headers    // for the message...if not, then go to UTF-8    if (opt->format_out != nsMimeOutput::nsMimeMessageSaveAs)      output_charset = "UTF-8";    // if we have an override charset, use it first...otherwise fall back to the    // default charset. Note: these charsets will only be used if the header isn't    // mime encoded.    const char * inputCharset = nsnull;    if (opt->override_charset)      inputCharset = opt->override_charset;    else if (opt->default_charset)      inputCharset = opt->default_charset;    // check if we're converting from input charset to utf-8, and if so, cache converters.    if (!opt->m_unicodeToUTF8Encoder)    {      if (!nsCRT::strcasecmp(output_charset, "UTF-8"))      {        nsresult rv;        nsCOMPtr<nsICharsetConverterManager2> ccm2 = do_GetService(NS_CHARSETCONVERTERMANAGER_PROGID, &rv);        if (NS_SUCCEEDED(rv))         {          nsCOMPtr <nsIAtom> sourceCharsetAtom;          nsCOMPtr <nsIAtom> destCharsetAtom;          opt->charsetForCachedInputDecoder = inputCharset;          nsAutoString sourceCharset, destCharset;          sourceCharset.AssignWithConversion(inputCharset);          destCharset.AssignWithConversion(output_charset);          rv = ccm2->GetCharsetAtom(sourceCharset.GetUnicode(), getter_AddRefs(sourceCharsetAtom));          rv = ccm2->GetCharsetAtom(destCharset.GetUnicode(), getter_AddRefs(destCharsetAtom));          ccm2->GetUnicodeDecoder(sourceCharsetAtom, getter_AddRefs(opt->m_inputCharsetToUnicodeDecoder));          ccm2->GetUnicodeEncoder(destCharsetAtom, getter_AddRefs(opt->m_unicodeToUTF8Encoder));        }      }    }    PRBool useInputCharsetConverter = opt->m_inputCharsetToUnicodeDecoder && !nsCRT::strcasecmp(inputCharset, opt->charsetForCachedInputDecoder);	  int status =		opt->rfc1522_conversion_fn(input, input_length,								   inputCharset, output_charset,  /* no input charset? */								   &converted, &converted_len,                   opt->stream_closure, (useInputCharsetConverter) ? opt->m_inputCharsetToUnicodeDecoder : nsnull, opt->m_unicodeToUTF8Encoder);	  if (status < 0)		{		  PR_FREEIF(converted);		  return status;		}	  if (converted)		{		  *output_ret = converted;		  *output_length_ret = converted_len;		}	}  return 0;}