nsComponentManager::CreateInstance(kSaveAsCharsetCID, nsnull, NS_GET_IID(nsISaveAsCharset), (void**) &gFontSubConverter);
CallCreateInstance(kSaveAsCharsetCID, &gFontSubConverter);
nsFontGTKSubstitute::Convert(const PRUnichar* aSrc, PRUint32 aSrcLen,  PRUnichar* aDest, PRUint32 aDestLen){  nsresult res;  if (!gFontSubConverter) {    nsComponentManager::CreateInstance(kSaveAsCharsetCID, nsnull,      NS_GET_IID(nsISaveAsCharset), (void**) &gFontSubConverter);    if (gFontSubConverter) {      res = gFontSubConverter->Init("ISO-8859-1",                             nsISaveAsCharset::attr_FallbackQuestionMark +                               nsISaveAsCharset::attr_EntityAfterCharsetConv +                               nsISaveAsCharset::attr_IgnoreIgnorables,                              nsIEntityConverter::transliterate);      if (NS_FAILED(res)) {        NS_RELEASE(gFontSubConverter);      }    }  }  if (gFontSubConverter) {    nsAutoString tmp(aSrc, aSrcLen);    char* conv = nsnull;    res = gFontSubConverter->Convert(tmp.get(), &conv);    if (NS_SUCCEEDED(res) && conv) {      char* p = conv;      PRUint32 i;      for (i = 0; i < aDestLen; i++) {        if (*p) {          aDest[i] = *p;        }        else {          break;        }        p++;      }      nsMemory::Free(conv);      conv = nsnull;      return i;    }  }  if (aSrcLen > aDestLen) {    aSrcLen = aDestLen;  }  for (PRUint32 i = 0; i < aSrcLen; i++) {    aDest[i] = '?';  }  return aSrcLen;}