aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-05-02 04:47:00 +0800
committerChristian Persch <chpe@src.gnome.org>2004-05-02 04:47:00 +0800
commit7093f6ad148d62a9ddc77f8080cf9822d5d24f1f (patch)
tree672ab4fb4d9e9853b14903b6c9019e911773fd93
parent8493f7c5d64b577b3f6b8de91e5bb6c82a8b96ae (diff)
downloadgsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.gz
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.bz2
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.lz
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.xz
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.zst
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.zip
Clean up encoding handling.
2004-05-01 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed.c: (ephy_embed_get_encoding), (ephy_embed_has_automatic_encoding): * embed/ephy-embed.h: * embed/ephy-encodings.c: * embed/ephy-encodings.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/MozRegisterComponents.cpp: * embed/mozilla/mozilla-embed.cpp: * src/ephy-encoding-dialog.c: (sync_embed_cb), (activate_choice): * src/ephy-encoding-menu.c: (update_encoding_menu_cb), (encoding_activate_cb): Clean up encoding handling.
-rw-r--r--ChangeLog17
-rw-r--r--embed/ephy-embed.c23
-rw-r--r--embed/ephy-embed.h9
-rw-r--r--embed/ephy-encodings.c9
-rw-r--r--embed/ephy-encodings.h2
-rw-r--r--embed/mozilla/EphyBrowser.cpp102
-rw-r--r--embed/mozilla/EphyBrowser.h4
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp2
-rw-r--r--embed/mozilla/mozilla-embed.cpp46
-rw-r--r--src/ephy-encoding-dialog.c33
-rw-r--r--src/ephy-encoding-menu.c33
11 files changed, 120 insertions, 160 deletions
diff --git a/ChangeLog b/ChangeLog
index cf1500bc4..17d8b156a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2004-05-01 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/ephy-embed.c: (ephy_embed_get_encoding),
+ (ephy_embed_has_automatic_encoding):
+ * embed/ephy-embed.h:
+ * embed/ephy-encodings.c:
+ * embed/ephy-encodings.h:
+ * embed/mozilla/EphyBrowser.cpp:
+ * embed/mozilla/EphyBrowser.h:
+ * embed/mozilla/MozRegisterComponents.cpp:
+ * embed/mozilla/mozilla-embed.cpp:
+ * src/ephy-encoding-dialog.c: (sync_embed_cb), (activate_choice):
+ * src/ephy-encoding-menu.c: (update_encoding_menu_cb),
+ (encoding_activate_cb):
+
+ Clean up encoding handling.
+
2004-05-01 Piers Cornwell <piers@gnome.org>
* help/C/epiphany.xml:
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index c38d8b5ce..1b38cda13 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -672,16 +672,29 @@ ephy_embed_set_encoding (EphyEmbed *embed,
}
/**
- * ephy_embed_get_encoding_info:
+ * ephy_embed_get_encoding:
* @embed: an #EphyEmbed
*
- * Returns @embed's #EphyEncodingInfo.
+ * Returns the @embed's document's encoding
**/
-EphyEncodingInfo *
-ephy_embed_get_encoding_info (EphyEmbed *embed)
+char *
+ephy_embed_get_encoding (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_encoding (embed);
+}
+
+/**
+ * ephy_embed_has_automatic_encoding:
+ * @embed: an #EphyEmbed
+ *
+ * Returns whether the @embed's document's was determined by the document itself
+ **/
+gboolean
+ephy_embed_has_automatic_encoding (EphyEmbed *embed)
{
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
- return iface->get_encoding_info (embed);
+ return iface->has_automatic_encoding (embed);
}
/**
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 809a21a56..9e8f26d6f 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -213,9 +213,10 @@ struct _EphyEmbedIface
gboolean wrap_around);
gboolean (* find_next) (EphyEmbed *embed,
gboolean backwards);
+ char * (* get_encoding) (EphyEmbed *embed);
+ gboolean (* has_automatic_encoding) (EphyEmbed *embed);
void (* set_encoding) (EphyEmbed *embed,
const char *encoding);
- EphyEncodingInfo * (* get_encoding_info) (EphyEmbed *embed);
void (* print) (EphyEmbed *embed,
EmbedPrintInfo *info);
void (* print_preview_close) (EphyEmbed *embed);
@@ -298,11 +299,13 @@ gboolean ephy_embed_find_next (EphyEmbed *embed,
gboolean backwards);
/* Encoding */
+char *ephy_embed_get_encoding (EphyEmbed *embed);
+
+gboolean ephy_embed_has_automatic_encoding (EphyEmbed *embed);
+
void ephy_embed_set_encoding (EphyEmbed *embed,
const char *encoding);
-EphyEncodingInfo *ephy_embed_get_encoding_info (EphyEmbed *embed);
-
/* Print */
void ephy_embed_print (EphyEmbed *embed,
EmbedPrintInfo *info);
diff --git a/embed/ephy-encodings.c b/embed/ephy-encodings.c
index 61b84617f..b58fbd9e5 100644
--- a/embed/ephy-encodings.c
+++ b/embed/ephy-encodings.c
@@ -499,15 +499,6 @@ ephy_encoding_info_free (EphyEncodingInfo *info)
}
}
-gboolean
-ephy_encoding_info_is_automatic (EphyEncodingInfo *info)
-{
- g_return_val_if_fail (info != NULL, FALSE);
-
- return (info->encoding_source < EMBED_ENCODING_PARENT_FORCED)
- && (info->forced_encoding == NULL || info->forced_encoding[0] == '\0');
-}
-
EphyEncodings *
ephy_encodings_new (void)
{
diff --git a/embed/ephy-encodings.h b/embed/ephy-encodings.h
index 6ab26cfa4..bb8dfea58 100644
--- a/embed/ephy-encodings.h
+++ b/embed/ephy-encodings.h
@@ -147,8 +147,6 @@ GList *ephy_encodings_get_recent (EphyEncodings *encodings);
void ephy_encoding_info_free (EphyEncodingInfo *info);
-gboolean ephy_encoding_info_is_automatic (EphyEncodingInfo *info);
-
G_END_DECLS
#endif
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index 01e0d60ca..157dceba6 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -638,6 +638,8 @@ nsresult EphyBrowser::GetTargetDocumentUrl (nsCString &url)
nsresult EphyBrowser::ForceEncoding (const char *encoding)
{
+ NS_ENSURE_TRUE (mInitialized, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIContentViewer> contentViewer;
GetContentViewer (getter_AddRefs(contentViewer));
NS_ENSURE_TRUE (contentViewer, NS_ERROR_FAILURE);
@@ -645,107 +647,53 @@ nsresult EphyBrowser::ForceEncoding (const char *encoding)
nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer);
NS_ENSURE_TRUE (mdv, NS_ERROR_FAILURE);
- nsresult result;
- result = mdv->SetForceCharacterSet (nsDependentCString(encoding));
-
- return result;
+ return mdv->SetForceCharacterSet (nsDependentCString(encoding));
}
-nsresult EphyBrowser::PushTargetDocument (nsIDOMDocument *domDoc)
+nsresult EphyBrowser::GetEncoding (nsACString &encoding)
{
- mTargetDocument = domDoc;
-
- return NS_OK;
-}
-
-nsresult EphyBrowser::PopTargetDocument ()
-{
- mTargetDocument = nsnull;
-
- return NS_OK;
-}
-
-nsresult EphyBrowser::GetEncodingInfo (EphyEncodingInfo **infoptr)
-{
- nsresult result;
- EphyEncodingInfo *info;
+ NS_ENSURE_TRUE (mInitialized, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDocument> domDoc;
GetTargetDocument (getter_AddRefs(domDoc));
NS_ENSURE_TRUE (domDoc, NS_ERROR_FAILURE);
- nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc, &result);
+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
NS_ENSURE_TRUE (doc, NS_ERROR_FAILURE);
- info = g_new0 (EphyEncodingInfo, 1);
- *infoptr = info;
-
- PRInt32 source;
- source = doc->GetDocumentCharacterSetSource ();
- info->encoding_source = (EphyEncodingSource) source;
-
- nsCOMPtr<nsIDocShell> ds;
- ds = do_GetInterface (mWebBrowser);
- NS_ENSURE_TRUE (ds, NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIDocumentCharsetInfo> ci;
- result = ds->GetDocumentCharsetInfo (getter_AddRefs (ci));
- NS_ENSURE_TRUE (ci, NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIAtom> atom;
- ci->GetForcedCharset (getter_AddRefs (atom));
- if (atom)
- {
- nsCAutoString atomstr;
- atom->ToUTF8String (atomstr);
- info->forced_encoding = g_strdup (atomstr.get());
- }
+ encoding = doc->GetDocumentCharacterSet ();
+ NS_ENSURE_TRUE (!encoding.IsEmpty(), NS_ERROR_FAILURE);
- ci->GetParentCharset (getter_AddRefs (atom));
- if (atom)
- {
- nsCAutoString atomstr;
- atom->ToUTF8String (atomstr);
- info->parent_encoding = g_strdup (atomstr.get());
- }
+ return NS_OK;
+}
- result = ci->GetParentCharsetSource (&source);
- NS_ENSURE_SUCCESS (result, NS_ERROR_FAILURE);
- info->parent_encoding_source = (EphyEncodingSource) source;
+nsresult EphyBrowser::GetForcedEncoding (nsACString &encoding)
+{
+ NS_ENSURE_TRUE (mInitialized, NS_ERROR_FAILURE);
nsCOMPtr<nsIContentViewer> contentViewer;
- ds->GetContentViewer (getter_AddRefs(contentViewer));
+ GetContentViewer (getter_AddRefs(contentViewer));
NS_ENSURE_TRUE (contentViewer, NS_ERROR_FAILURE);
nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer);
NS_ENSURE_TRUE (mdv, NS_ERROR_FAILURE);
- const nsACString& charsetEnc = doc->GetDocumentCharacterSet ();
- NS_ENSURE_TRUE (!charsetEnc.IsEmpty(), NS_ERROR_FAILURE);
-
- info->encoding = g_strdup (PromiseFlatCString(charsetEnc).get());
-
- nsCAutoString enc;
-
- result = mdv->GetDefaultCharacterSet (enc);
+ nsresult result = mdv->GetForceCharacterSet (encoding);
NS_ENSURE_SUCCESS (result, NS_ERROR_FAILURE);
- info->default_encoding = g_strdup (enc.get());
- result = mdv->GetForceCharacterSet (enc);
- NS_ENSURE_SUCCESS (result, NS_ERROR_FAILURE);
- info->forced_encoding = g_strdup (enc.get());
+ return NS_OK;
+}
- result = mdv->GetHintCharacterSet (enc);
- NS_ENSURE_SUCCESS (result, NS_ERROR_FAILURE);
- info->hint_encoding = g_strdup (enc.get());
+nsresult EphyBrowser::PushTargetDocument (nsIDOMDocument *domDoc)
+{
+ mTargetDocument = domDoc;
- result = mdv->GetPrevDocCharacterSet (enc);
- NS_ENSURE_SUCCESS (result, NS_ERROR_FAILURE);
- info->prev_doc_encoding = g_strdup (enc.get());
+ return NS_OK;
+}
- mdv->GetHintCharacterSetSource (&source);
- NS_ENSURE_SUCCESS (result, NS_ERROR_FAILURE);
- info->hint_encoding_source = (EphyEncodingSource) source;
+nsresult EphyBrowser::PopTargetDocument ()
+{
+ mTargetDocument = nsnull;
return NS_OK;
}
diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h
index 16a967c3b..4fef54986 100644
--- a/embed/mozilla/EphyBrowser.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -101,8 +101,8 @@ public:
nsresult GoToHistoryIndex (PRInt16 index);
nsresult ForceEncoding (const char *encoding);
-
- nsresult GetEncodingInfo (EphyEncodingInfo **infoptr);
+ nsresult GetEncoding (nsACString &encoding);
+ nsresult GetForcedEncoding (nsACString &encoding);
nsresult PushTargetDocument (nsIDOMDocument *domDoc);
nsresult PopTargetDocument ();
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index fc5c92a85..a99f15b10 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -182,7 +182,7 @@ mozilla_register_components (void)
NS_GetComponentManager (getter_AddRefs (cm));
NS_ENSURE_TRUE (cm, FALSE);
- for (int i = 0; i < G_N_ELEMENTS (sAppComps); i++)
+ for (guint i = 0; i < G_N_ELEMENTS (sAppComps); i++)
{
nsCOMPtr<nsIGenericFactory> componentFactory;
rv = NS_NewGenericFactory(getter_AddRefs(componentFactory),
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 82b8adf14..4452fa334 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -724,31 +724,56 @@ impl_set_encoding (EphyEmbed *embed,
{
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
nsresult result;
+ nsCAutoString currEnc;
- result = mpriv->browser->ForceEncoding (encoding);
+ g_return_if_fail (encoding != NULL);
+
+ result = mpriv->browser->GetEncoding (currEnc);
if (NS_FAILED (result)) return;
+ if (!currEnc.Equals(encoding) ||
+ encoding[0] == '\0' && !ephy_embed_has_automatic_encoding (embed))
+ {
+ result = mpriv->browser->ForceEncoding (encoding);
+ if (NS_FAILED (result)) return;
+ }
+
gtk_moz_embed_reload (GTK_MOZ_EMBED (embed),
GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE);
}
-static EphyEncodingInfo *
-impl_get_encoding_info (EphyEmbed *embed)
+static char *
+impl_get_encoding (EphyEmbed *embed)
{
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
nsresult result;
- EphyEncodingInfo *info = NULL;
+ nsCAutoString encoding;
- result = mpriv->browser->GetEncodingInfo (&info);
+ result = mpriv->browser->GetEncoding (encoding);
- if (NS_FAILED (result))
+ if (NS_FAILED (result) || encoding.IsEmpty())
{
- ephy_encoding_info_free (info);
-
return NULL;
}
- return info;
+ return g_strdup (encoding.get());
+}
+
+static gboolean
+impl_has_automatic_encoding (EphyEmbed *embed)
+{
+ MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
+ nsresult result;
+ nsCAutoString encoding;
+
+ result = mpriv->browser->GetForcedEncoding (encoding);
+
+ if (NS_FAILED (result) || encoding.IsEmpty())
+ {
+ return TRUE;
+ }
+
+ return FALSE;
}
static gboolean
@@ -1103,7 +1128,8 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->activate = impl_activate;
iface->find_set_properties = impl_find_set_properties;
iface->set_encoding = impl_set_encoding;
- iface->get_encoding_info = impl_get_encoding_info;
+ iface->get_encoding = impl_get_encoding;
+ iface->has_automatic_encoding = impl_has_automatic_encoding;
iface->print = impl_print;
iface->print_preview_close = impl_print_preview_close;
iface->print_preview_n_pages = impl_print_preview_n_pages;
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 3365fa5af..adf0f61f3 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -113,12 +113,12 @@ static void
sync_embed_cb (EphyEncodingDialog *dialog, GParamSpec *pspec, gpointer dummy)
{
EphyEmbed *embed;
- EphyEncodingInfo *info;
EphyNode *node;
GtkTreeSelection *selection;
GtkTreeModel *model;
GList *rows;
GtkWidget *button;
+ char *encoding;
gboolean is_automatic;
dialog->priv->update_tag = TRUE;
@@ -126,10 +126,10 @@ sync_embed_cb (EphyEncodingDialog *dialog, GParamSpec *pspec, gpointer dummy)
embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog));
g_return_if_fail (EPHY_IS_EMBED (embed));
- info = ephy_embed_get_encoding_info (embed);
- if (info == NULL) return;
+ encoding = ephy_embed_get_encoding (embed);
+ if (encoding == NULL) return;
- node = ephy_encodings_get_node (dialog->priv->encodings, info->encoding, TRUE);
+ node = ephy_encodings_get_node (dialog->priv->encodings, encoding, TRUE);
g_assert (EPHY_IS_NODE (node));
/* select the current encoding in the list view */
@@ -153,12 +153,12 @@ sync_embed_cb (EphyEncodingDialog *dialog, GParamSpec *pspec, gpointer dummy)
g_list_free (rows);
}
- is_automatic = ephy_encoding_info_is_automatic (info);
+ is_automatic = ephy_embed_has_automatic_encoding (embed);
button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), is_automatic);
- ephy_encoding_info_free (info);
+ g_free (encoding);
dialog->priv->update_tag = FALSE;
}
@@ -199,27 +199,18 @@ static void
activate_choice (EphyEncodingDialog *dialog)
{
EphyEmbed *embed;
- EphyEncodingInfo *info;
GtkWidget *button;
gboolean is_automatic;
embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog));
g_return_if_fail (EPHY_IS_EMBED (embed));
- info = ephy_embed_get_encoding_info (embed);
- if (info == NULL) return;
-
button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id);
is_automatic = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
if (is_automatic)
{
- /* only unset if it was forced before */
- if ((info->forced_encoding != NULL && info->forced_encoding[0] != '\0')
- || info->encoding_source >= EMBED_ENCODING_PARENT_FORCED)
- {
- ephy_embed_set_encoding (embed, "");
- }
+ ephy_embed_set_encoding (embed, "");
}
else if (dialog->priv->selected_node != NULL)
{
@@ -228,16 +219,10 @@ activate_choice (EphyEncodingDialog *dialog)
code = ephy_node_get_property_string (dialog->priv->selected_node,
EPHY_NODE_ENCODING_PROP_ENCODING);
- /* only force it if it's different from active */
- if (info->encoding && strcmp (info->encoding, code) != 0)
- {
- ephy_embed_set_encoding (embed, code);
+ ephy_embed_set_encoding (embed, code);
- ephy_encodings_add_recent (dialog->priv->encodings, code);
- }
+ ephy_encodings_add_recent (dialog->priv->encodings, code);
}
-
- ephy_encoding_info_free (info);
}
void
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index 3eade8ced..b35ada0e6 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -150,9 +150,8 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
EphyEncodingMenuPrivate *p = menu->priv;
EphyEmbed *embed;
GtkAction *action;
- EphyEncodingInfo *info;
char name[128];
- const char *encoding;
+ char *encoding;
EphyNode *enc_node;
GList *recent, *related = NULL, *l;
EphyLanguageGroup groups;
@@ -170,24 +169,14 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
recent = ephy_encodings_get_recent (p->encodings);
embed = ephy_window_get_active_embed (p->window);
- info = ephy_embed_get_encoding_info (embed);
- if (info == NULL) goto build_menu;
-
- LOG ("encoding information\n enc='%s' default='%s' hint='%s' "
- "prev_doc='%s' forced='%s' parent='%s' source=%d "
- "hint_source=%d parent_source=%d", info->encoding,
- info->default_encoding, info->hint_encoding,
- info->prev_doc_encoding, info->forced_encoding,
- info->parent_encoding, info->encoding_source,
- info->hint_encoding_source, info->parent_encoding_source)
-
- encoding = info->encoding;
+ encoding = ephy_embed_get_encoding (embed);
+ if (encoding == NULL) goto build_menu;
enc_node = ephy_encodings_get_node (p->encodings, encoding, TRUE);
g_assert (EPHY_IS_NODE (enc_node));
/* check if encoding was overridden */
- is_automatic = ephy_encoding_info_is_automatic (info);
+ is_automatic = ephy_embed_has_automatic_encoding (embed);
action = gtk_action_group_get_action (p->action_group,
"ViewEncodingAutomatic");
@@ -269,7 +258,7 @@ build_menu:
g_list_free (related);
g_list_free (recent);
- ephy_encoding_info_free (info);
+ g_free (encoding);
menu->priv->update_tag = FALSE;
@@ -280,7 +269,6 @@ static void
encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
{
EphyEmbed *embed;
- EphyEncodingInfo *info;
const char *name, *encoding;
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) == FALSE
@@ -294,16 +282,7 @@ encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
embed = ephy_window_get_active_embed (menu->priv->window);
- info = ephy_embed_get_encoding_info (embed);
- if (info == NULL) return;
-
- /* Force only when different from current encoding */
- if (info->encoding && strcmp (info->encoding, encoding) != 0)
- {
- ephy_embed_set_encoding (embed, encoding);
- }
-
- ephy_encoding_info_free (info);
+ ephy_embed_set_encoding (embed, encoding);
ephy_encodings_add_recent (menu->priv->encodings, encoding);
}