PL_strcpy(progid, NS_UNICODEDECODER_PROGID_BASE);
PL_strcpy(progid, NS_UNICODEENCODER_PROGID_BASE);
NS_IMETHODIMP nsConverterModule::RegisterSelf(nsIComponentManager *aCompMgr,                                              nsIFileSpec* aPath,                                              const char* registryLocation,                                              const char* componentType){  nsresult res;  PRUint32 i;  nsIComponentManager * compMgr = NULL;  nsIRegistry * registry = NULL;  nsRegistryKey key;  char buff[1024];  // get the registry  res = nsServiceManager::GetService(NS_REGISTRY_PROGID,       nsIRegistry::GetIID(), (nsISupports**)&registry);  if (NS_FAILED(res)) goto done;  // open the registry  res = registry->OpenWellKnownRegistry(      nsIRegistry::ApplicationComponentRegistry);  if (NS_FAILED(res)) goto done;  char name[128];  char progid[128];  char * cid_string;  for (i=0; i<ARRAY_SIZE(g_FactoryData); i++) {    if(0==PL_strcmp(g_FactoryData[i].mCharsetSrc,"Unicode"))    {       PL_strcpy(name, DECODER_NAME_BASE);       PL_strcat(name, g_FactoryData[i].mCharsetDest);       PL_strcpy(progid, NS_UNICODEDECODER_PROGID_BASE);       PL_strcat(progid, g_FactoryData[i].mCharsetDest);    } else {       PL_strcpy(name, ENCODER_NAME_BASE);       PL_strcat(name, g_FactoryData[i].mCharsetSrc);       PL_strcpy(progid, NS_UNICODEENCODER_PROGID_BASE);       PL_strcat(progid, g_FactoryData[i].mCharsetSrc);    }    // register component    res = aCompMgr->RegisterComponentSpec(*(g_FactoryData[i].mCID), name,       progid, aPath, PR_TRUE, PR_TRUE);    if(NS_FAILED(res) && (NS_ERROR_FACTORY_EXISTS != res)) goto done;    // register component info    // XXX take these KONSTANTS out of here; refine this code    cid_string = g_FactoryData[i].mCID->ToString();    sprintf(buff, "%s/%s", "software/netscape/intl/uconv", cid_string);    nsCRT::free(cid_string);    res = registry -> AddSubtree(nsIRegistry::Common, buff, &key);    if (NS_FAILED(res)) goto done;    res = registry -> SetString(key, "source", g_FactoryData[i].mCharsetSrc);    if (NS_FAILED(res)) goto done;    res = registry -> SetString(key, "destination", g_FactoryData[i].mCharsetDest);    if (NS_FAILED(res)) goto done;  }done:  if (registry != NULL) {    registry -> Close();    nsServiceManager::ReleaseService(NS_REGISTRY_PROGID, registry);  }  return res;}