From 6af1840e75795670c94835cf1298ca073b5d9b9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enrico=20Tr=C3=B6ger?= Date: Sat, 14 Feb 2009 12:36:18 +0100 Subject: [PATCH] Convert source code for display from the locale encoding --- midori/midori-source.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/midori/midori-source.c b/midori/midori-source.c index 1bd98774..21524340 100644 --- a/midori/midori-source.c +++ b/midori/midori-source.c @@ -87,6 +87,7 @@ midori_source_transfer_cb (KatzeNetRequest* request, { gchar** mimev; gchar* charset; + const gchar* default_charset; gchar* contents_utf8; GtkTextBuffer* buffer; @@ -103,8 +104,14 @@ midori_source_transfer_cb (KatzeNetRequest* request, charset = g_strdup (&mimev[1][8]); g_strfreev (mimev); } + g_get_charset (&default_charset); contents_utf8 = g_convert (request->data, -1, "UTF-8", - charset ? charset : "ISO-8859-1", NULL, NULL, NULL); + charset ? charset : default_charset, NULL, NULL, NULL); + /* If conversion from the user's locale also failed, + try ISO-8859-1 as a last resort */ + if (!contents_utf8) + contents_utf8 = g_convert (request->data, -1, "UTF-8", + "ISO-8859-1", NULL, NULL, NULL); } else contents_utf8 = (gchar*)request->data; -- 2.39.5