if (!charset) charset = "ISO-8859-1";
if ( (!charset) || ( (charset) && (!nsCRT::strcasecmp(charset, "us-ascii"))) ) charset = nsCRT::strdup("ISO-8859-1");
WriteLineToStream (MimeObject *obj, const char *line)               {                                                                                int     status = 0;  char    *htmlLine;  int     htmlLen ;  char    *converted = NULL;  PRInt32 converted_length;  PRInt32 res;  char    *charset = nsnull;  if ( (!line) || (!*line) )    return 0;  // Seek out a charset!  charset = PL_strcasestr(obj->content_type, "charset=");  if (!charset)    charset = FindCharacterSet(obj);  if (!charset)    charset = "ISO-8859-1";    // convert from the resource charset.  res = INTL_ConvertCharset(charset, "UTF-8", line, nsCRT::strlen(line),                            &converted, &converted_length);  if ( (res != 0) || (converted == NULL) )    converted = (char *)line;  else    converted[converted_length] = '\0';    htmlLen = nsCRT::strlen(converted) + nsCRT::strlen("<DT></DT>") + 1;  htmlLine = (char *) PR_MALLOC (htmlLen);  if (htmlLine)  {    htmlLine[0] = '\0';    PL_strcat (htmlLine, "<DT>");    PL_strcat (htmlLine, converted);    PL_strcat (htmlLine, "</DT>");    status = COM_MimeObject_write(obj, htmlLine, nsCRT::strlen(htmlLine), PR_TRUE);    PR_Free ((void*) htmlLine);  }  else    status = VCARD_OUT_OF_MEMORY;    if (converted != line)    PR_FREEIF(converted);  PR_FREEIF(charset);  return status;}