res = ccMan->GetCharsetTitle2(cs, &str); if (NS_FAILED(res)) str.SetLength(0); NS_LossyConvertUCS2toASCII buff2(str);
nsresult nsTestUConv::DisplayCharsets(){  char * trace = "DisplayCharsets";  mLog.AddTrace(trace);  nsresult res = NS_OK;  nsCOMPtr<nsICharsetConverterManager2> ccMan =            do_GetService(kCharsetConverterManagerCID, &res);  if (NS_FAILED(res)) {    mLog.PrintError("NS_WITH_SERVICE", res);    return res;  }  nsCOMPtr<nsISupportsArray> array;  nsCOMPtr<nsISupportsArray> encArray;  res = ccMan->GetDecoderList(getter_AddRefs(array));  if (NS_FAILED(res)) {    mLog.PrintError("GetDecoderList()", res);    return res;  }  res = ccMan->GetEncoderList(getter_AddRefs(encArray));  if (NS_FAILED(res)) {    mLog.PrintError("GetEncoderList()", res);    return res;  }  res = AddArray(array, encArray);  if (NS_FAILED(res)) return res;  PRUint32 count;  res = array->Count(&count);  if (NS_FAILED(res)) {    mLog.PrintError("Count()", res);    return res;  }  printf("***** Character Sets [%d] *****\n", count);  for (PRUint32 i = 0; i < count; i++) {    nsCOMPtr<nsIAtom> cs;    nsAutoString str;    nsAutoString prop;    res = array->GetElementAt(i, getter_AddRefs(cs));    if (NS_FAILED(res)) {      mLog.PrintError("GetElementAt()", res);      return res;    }    const PRUnichar * name;    res = cs->GetUnicode(&name);    if (NS_FAILED(res)) {      mLog.PrintError("get()", res);      return res;    }    str.Assign(name);    NS_LossyConvertUCS2toASCII buff(str);    printf("%s", buff.get());    PrintSpaces(24 - buff.Length());  // align to hard coded column number    res = ccMan->GetCharsetTitle2(cs, &str);    if (NS_FAILED(res)) str.SetLength(0);    NS_LossyConvertUCS2toASCII buff2(str);    nsCOMPtr<nsIUnicodeDecoder> dec = NULL;    res = ccMan->GetUnicodeDecoder(cs, getter_AddRefs(dec));    if (NS_FAILED(res)) printf (" ");     else printf("D");    nsCOMPtr<nsIUnicodeEncoder> enc = NULL;    res = ccMan->GetUnicodeEncoder(cs, getter_AddRefs(enc));    if (NS_FAILED(res)) printf (" ");     else printf("E");    printf(" ");    prop.Assign(NS_LITERAL_STRING(".notForBrowser"));    res = ccMan->GetCharsetData2(cs, prop.get(), &str);    if ((dec != NULL) && (NS_FAILED(res))) printf ("B");     else printf("X");    prop.Assign(NS_LITERAL_STRING(".notForComposer"));    res = ccMan->GetCharsetData2(cs, prop.get(), &str);    if ((enc != NULL) && (NS_FAILED(res))) printf ("C");     else printf("X");    prop.Assign(NS_LITERAL_STRING(".notForMailView"));    res = ccMan->GetCharsetData2(cs, prop.get(), &str);    if ((dec != NULL) && (NS_FAILED(res))) printf ("V");     else printf("X");    prop.Assign(NS_LITERAL_STRING(".notForMailEdit"));    res = ccMan->GetCharsetData2(cs, prop.get(), &str);    if ((enc != NULL) && (NS_FAILED(res))) printf ("E");     else printf("X");    printf(" \"%s\"\n", buff2);  }  mLog.DelTrace(trace);  return NS_OK;}