if (NS_SUCCEEDED(rv)) rv = m_pEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nsnull, '?');
NS_IMETHODIMP nsImportService::SystemStringFromUnicode(const PRUnichar *uniStr, nsCString & sysStr){	nsresult	rv;	if (m_sysCharset.IsEmpty()) {		nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);		if (NS_SUCCEEDED(rv)) 			rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, m_sysCharset);		if (NS_FAILED(rv)) 			m_sysCharset.Assign(NS_LITERAL_STRING("ISO-8859-1"));	}	if (!uniStr) {		sysStr.Truncate();		return NS_OK;	}	if (*uniStr == '\0') {		sysStr.Truncate();		return NS_OK;	}	if (m_sysCharset.IsEmpty() ||		m_sysCharset.EqualsIgnoreCase("us-ascii") ||		m_sysCharset.EqualsIgnoreCase("ISO-8859-1")) {		sysStr.AssignWithConversion(uniStr);		return NS_OK;	}	if (!m_pEncoder) {		nsCOMPtr<nsICharsetConverterManager2> ccm2 = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);		if (NS_SUCCEEDED( rv) && (nsnull != ccm2)) {			// get charset atom due to getting unicode converter			nsCOMPtr <nsIAtom> charsetAtom;			rv = ccm2->GetCharsetAtom(m_sysCharset.get(), getter_AddRefs(charsetAtom));			// get an unicode converter			rv = ccm2->GetUnicodeEncoder(charsetAtom, &m_pEncoder);		}	}	if (m_pEncoder) {		PRInt32 srcLen = nsCRT::strlen(uniStr);		char *  chars;		PRInt32 charLength = 0;		rv = m_pEncoder->GetMaxLength( uniStr, srcLen, &charLength);		// allocale an output buffer		chars = NS_STATIC_CAST(char*, nsMemory::Alloc((charLength + 1) * sizeof(char)));		if (chars != nsnull) {			// convert to unicode			rv = m_pEncoder->Convert( uniStr, &srcLen, chars, &charLength);			sysStr.Assign(chars, charLength);			nsMemory::Free(chars);		}		else			rv = NS_ERROR_OUT_OF_MEMORY;	}		if (NS_FAILED( rv))		sysStr.AssignWithConversion(uniStr);	return rv;}