if (text->needUpdateMsgWinCharset && *text->charset) { if (!nsCRT::strcasecmp(text->charset, "us-ascii")) SetMailCharacterSetToMsgWindow(obj, NS_LITERAL_STRING("ISO-8859-1").get()); else SetMailCharacterSetToMsgWindow(obj, NS_ConvertASCIItoUCS2(text->charset).get()); }
if (text->needUpdateMsgWinCharset && *text->charset) SetMailCharacterSetToMsgWindow(obj, text->charset);
MimeInlineText_convert_and_parse_line(char *line, PRInt32 length, MimeObject *obj){  int status;  char *converted = 0;  PRInt32 converted_len = 0;    MimeInlineText *text = (MimeInlineText *) obj;  //in case of charset autodetection, charset can be override by meta charset  if (text->charsetOverridable) {    if (mime_typep(obj, (MimeObjectClass *) &mimeInlineTextHTMLClass))    {      MimeInlineTextHTML  *textHTML = (MimeInlineTextHTML *) obj;      if (textHTML->charset &&           *textHTML->charset &&          nsCRT::strcmp(textHTML->charset, text->charset))      {        //if meta tag specified charset is different from our detected result, use meta charset.        //but we don't want to redo previous lines        MIME_get_unicode_decoder(textHTML->charset, getter_AddRefs(text->inputDecoder));        PR_FREEIF(text->charset);        text->charset = nsCRT::strdup(textHTML->charset);        //update MsgWindow charset if we are instructed to do so        if (text->needUpdateMsgWinCharset && *text->charset) {          if (!nsCRT::strcasecmp(text->charset, "us-ascii"))            SetMailCharacterSetToMsgWindow(obj, NS_LITERAL_STRING("ISO-8859-1").get());          else            SetMailCharacterSetToMsgWindow(obj, NS_ConvertASCIItoUCS2(text->charset).get());        }      }    }  }  //initiate decoder if not yet  if (text->inputDecoder == nsnull)    MIME_get_unicode_decoder(text->charset, getter_AddRefs(text->inputDecoder));  if (text->utf8Encoder == nsnull)    MIME_get_unicode_encoder("UTF-8", getter_AddRefs(text->utf8Encoder));  PRBool useInputCharsetConverter = obj->options->m_inputCharsetToUnicodeDecoder && !nsCRT::strcasecmp(text->charset, obj->options->charsetForCachedInputDecoder.get());  if (useInputCharsetConverter)    status = obj->options->charset_conversion_fn(line, length,                         text->charset,												 "UTF-8",												 &converted,												 &converted_len,                         obj->options->stream_closure, obj->options->m_inputCharsetToUnicodeDecoder,                       obj->options->m_unicodeToUTF8Encoder);  else    status = obj->options->charset_conversion_fn(line, length,                         text->charset,												 "UTF-8",												 &converted,												 &converted_len,                         obj->options->stream_closure, (nsIUnicodeDecoder*)text->inputDecoder,                         (nsIUnicodeEncoder*)text->utf8Encoder);  if (status < 0)  {    PR_FREEIF(converted);    return status;  }  if (converted)  {    line = converted;    length = converted_len;  }  /* Now that the line has been converted, call the subclass's parse_line	 method with the decoded data. */  status = obj->clazz->parse_line(line, length, obj);  PR_FREEIF(converted);  return status;}