nsCOMPtr<nsICharsetConverterManager> ccm( do_GetService(kCharsetConverterManagerCID, &rv));
nsAutoString charset(aCharset); if(charset.Equals(NS_LITERAL_STRING("ISO-8859-1"))) charset.Assign(NS_LITERAL_STRING("windows-1252"));  rv = CallCreateInstance( NS_SAVEASCHARSET_CONTRACTID, aEncoder); NS_ASSERTION(NS_SUCCEEDED(rv), "create nsISaveAsCharset failed");
nsFormSubmission::GetEncoder(nsIForm* form,                             nsIPresContext* aPresContext,                             PRUint8 aCtrlsModAtSubmit,                             const nsAString& aCharset,                             nsIUnicodeEncoder** encoder){  *encoder = nsnull;  nsresult rv = NS_OK;#ifdef DEBUG_ftang  printf("charset=%s\n", ToNewCString(charset));#endif  // Get Charset, get the encoder.  nsCOMPtr<nsICharsetConverterManager> ccm(      do_GetService(kCharsetConverterManagerCID, &rv));  NS_ENSURE_SUCCESS(rv, rv);  if (ccm) {     nsString charset(aCharset);     if (charset.Equals(NS_LITERAL_STRING("ISO-8859-1")))       charset.Assign(NS_LITERAL_STRING("windows-1252"));     rv = ccm->GetUnicodeEncoder(&charset, encoder);     NS_ENSURE_SUCCESS(rv, rv);     // XXX Commenting this out for now since it was never called up until now     // and no one appears to have noticed.  But it appears to be useful stuff,     // so it stays for the day when we realize we're doing it wrong.     // rv = (*encoder)->SetOutputErrorBehavior(     //                    nsIUnicodeEncoder::kOnError_Replace,     //                    nsnull,     //                    (PRUnichar)'?');  }  return NS_OK;}