static char *gDefCharset = nsnull;
static PRUnichar *gDefCharset = nsnull;
NS_IMETHODIMP DocumentViewerImpl::GetDefaultCharacterSet(PRUnichar** aDefaultCharacterSet){  NS_ENSURE_ARG_POINTER(aDefaultCharacterSet);  NS_ENSURE_STATE(mContainer);  static char *gDefCharset = nsnull;    // XXX: memory leak!  if (0 == mDefaultCharacterSet.Length())   {    if ((nsnull == gDefCharset) || (nsnull == *gDefCharset))     {      nsCOMPtr<nsIWebShell> webShell;      webShell = do_QueryInterface(mContainer);      if (webShell)      {        nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));        if(prefs)          prefs->CopyCharPref("intl.charset.default", &gDefCharset);      }    }    if ((nsnull == gDefCharset) || (nsnull == *gDefCharset))      mDefaultCharacterSet.AssignWithConversion("ISO-8859-1");    else      mDefaultCharacterSet.AssignWithConversion(gDefCharset);  }  *aDefaultCharacterSet = mDefaultCharacterSet.ToNewUnicode();  return NS_OK;}