ConvertStringToUnicode(nsAutoString& aCharset, const char* inString, nsAutoString& outString)
ConvertStringToUnicode(nsString& aCharset, const char* inString, nsAWritableString& outString)
ConvertStringToUnicode(nsAutoString& aCharset, const char* inString, nsAutoString& outString){    nsresult rv;    // convert result to unicode    nsCOMPtr<nsICharsetConverterManager> ccm =              do_GetService(kCharsetConverterManagerCID, &rv);    if(NS_SUCCEEDED(rv)) {        nsCOMPtr <nsIUnicodeDecoder> decoder; // this may be cached        rv = ccm->GetUnicodeDecoder(&aCharset, getter_AddRefs(decoder));        if(NS_SUCCEEDED(rv) && decoder) {            PRInt32 uniLength = 0;            PRInt32 srcLength = nsCRT::strlen(inString);            rv = decoder->GetMaxLength(inString, srcLength, &uniLength);            if (NS_SUCCEEDED(rv)) {                PRUnichar *unichars = new PRUnichar [uniLength];                if (nsnull != unichars) {                    // convert to unicode                    rv = decoder->Convert(inString, &srcLength, unichars, &uniLength);                    if (NS_SUCCEEDED(rv)) {                        // Pass back the unicode string                        outString.Assign(unichars, uniLength);                    }                    delete [] unichars;                }                else {                    rv = NS_ERROR_OUT_OF_MEMORY;                }            }        }        }    return rv;}