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_open_dam(char *line, PRInt32 length, MimeObject *obj){  MimeInlineText *text = (MimeInlineText *) obj;  const char* detectedCharset = nsnull;  nsresult res = NS_OK;  int status = 0;  PRInt32 i;  if (text->curDamOffset <= 0) {    //there is nothing in dam, use current line for detection    if (length > 0) {      res = MIME_detect_charset(line, length, &detectedCharset);      }  } else {    //we have stuff in dam, use the one     res = MIME_detect_charset(text->lineDamBuffer, text->curDamOffset, &detectedCharset);    }  //set the charset for this obj  if (NS_SUCCEEDED(res) && detectedCharset && *detectedCharset)  {    PR_FREEIF(text->charset);    text->charset = nsCRT::strdup(detectedCharset);    //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());    }  }  //process dam and line using the charset  if (text->curDamOffset) {    for (i = 0; i < text->lastLineInDam-1; i++)    {      status = MimeInlineText_convert_and_parse_line(                text->lineDamPtrs[i],                  text->lineDamPtrs[i+1] - text->lineDamPtrs[i],                obj  );    }    status = MimeInlineText_convert_and_parse_line(                text->lineDamPtrs[i],                text->lineDamBuffer + text->curDamOffset - text->lineDamPtrs[i],                obj );  }  if (length)    status = MimeInlineText_convert_and_parse_line(line, length, obj);  PR_Free(text->lineDamPtrs);  PR_Free(text->lineDamBuffer);  text->lineDamPtrs = nsnull;  text->lineDamBuffer = nsnull;  text->inputAutodetect = PR_FALSE;  return status;}