nsXPIDLString defCharset;  nsCOMPtr<nsIWebShell> webShell; webShell = do_QueryInterface(mContainer); if (webShell) { nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); if (prefBranch) { nsCOMPtr<nsIPrefLocalizedString> prefLocalString; prefBranch->GetComplexValue("intl.charset.default", NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(prefLocalString)); if (prefLocalString) { prefLocalString->GetData(getter_Copies(defCharset)); } } }
const nsAdoptingString& defCharset = nsContentUtils::GetLocalizedStringPref("intl.charset.default");
NS_IMETHODIMP DocumentViewerImpl::GetDefaultCharacterSet(nsACString& aDefaultCharacterSet){  NS_ENSURE_STATE(mContainer);  if (mDefaultCharacterSet.IsEmpty())  {    nsXPIDLString defCharset;    nsCOMPtr<nsIWebShell> webShell;    webShell = do_QueryInterface(mContainer);    if (webShell)    {      nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));      if (prefBranch) {        nsCOMPtr<nsIPrefLocalizedString> prefLocalString;        prefBranch->GetComplexValue("intl.charset.default",                                    NS_GET_IID(nsIPrefLocalizedString),                                    getter_AddRefs(prefLocalString));        if (prefLocalString) {          prefLocalString->GetData(getter_Copies(defCharset));        }      }    }    if (!defCharset.IsEmpty())      CopyUCS2toASCII(defCharset, mDefaultCharacterSet);    else      mDefaultCharacterSet.Assign(NS_LITERAL_CSTRING("ISO-8859-1"));  }  aDefaultCharacterSet = mDefaultCharacterSet;  return NS_OK;}