From 6c94575f7a9971a6784905e8634fabec5683a53e Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 27 Oct 2003 18:43:45 +0000 Subject: We need to force the encoding to be able to unset it. 2003-10-27 Marco Pesenti Gritti * embed/mozilla/EphyBrowser.cpp: We need to force the encoding to be able to unset it. --- ChangeLog | 7 +++++++ embed/mozilla/EphyBrowser.cpp | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 916540a04..3b826b2a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-10-27 Marco Pesenti Gritti + + * embed/mozilla/EphyBrowser.cpp: + + We need to force the encoding to be able + to unset it. + 2003-10-27 Christian Persch * embed/mozilla/EphyHeaderSniffer.cpp: diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 812ba9b53..f01965381 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -30,7 +30,6 @@ #include #include -#include "nsIDocCharset.h" #include "nsICommandManager.h" #include "nsIContentViewer.h" #include "nsIGlobalHistory.h" @@ -372,6 +371,8 @@ nsresult EphyBrowser::GetDocument (nsIDOMDocument **aDOMDocument) { NS_ENSURE_ARG_POINTER(aDOMDocument); NS_IF_ADDREF(*aDOMDocument = mDOMDocument); + + return NS_OK; } nsresult EphyBrowser::GetTargetDocument (nsIDOMDocument **aDOMDocument) @@ -574,16 +575,18 @@ nsresult EphyBrowser::ForceEncoding (const char *encoding) { nsresult result; - g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE); - - nsCOMPtr docShell; - docShell = do_GetInterface (mWebBrowser); - if (!docShell) return NS_ERROR_FAILURE; + nsCOMPtr contentViewer; + result = GetContentViewer (getter_AddRefs(contentViewer)); + if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE; - nsCOMPtr docCharset; - docCharset = do_QueryInterface (docShell); + nsCOMPtr mdv = do_QueryInterface(contentViewer); + if (!mdv) return NS_ERROR_FAILURE; - result = docCharset->SetCharset (encoding); + #if MOZILLA_SNAPSHOT > 9 + result = mdv->SetForceCharacterSet (nsDependentCString(encoding)); + #else + result = mdv->SetForceCharacterSet (NS_ConvertUTF8toUCS2(encoding).get()); + #endif return result; } -- cgit v1.2.3