diff --git a/midori/main.c b/midori/main.c index 834e47d5..a8400f39 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1776,13 +1776,19 @@ main (int argc, i = 0; while (uris[i] != NULL) { - #if GLIB_CHECK_VERSION (2, 22, 0) - gchar* encoded = g_hostname_to_unicode (uris[i]); + #ifdef HAVE_LIBSOUP_2_27_90 + gchar* path; + gchar* hostname = sokoke_hostname_from_uri (uris[i], &path); + gchar* encoded = g_hostname_to_ascii (hostname); + if (encoded) { + gchar* res = g_strconcat ("http://", encoded, path, NULL); g_free (uris[i]); - uris[i] = encoded; + g_free (encoded); + uris[i] = res; } + g_free (hostname); #else uris[i] = sokoke_idn_to_punycode (uris[i]); #endif diff --git a/midori/sokoke.c b/midori/sokoke.c index 2a9d966b..1b986ca2 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -197,7 +197,7 @@ sokoke_spawn_program (const gchar* command, * * Return value: a newly allocated hostname **/ -static gchar* +gchar* sokoke_hostname_from_uri (const gchar* uri, gchar** path) { diff --git a/midori/sokoke.h b/midori/sokoke.h index 15f2c882..854b0c33 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -41,6 +41,10 @@ sokoke_spawn_program (const gchar* command, gchar* sokoke_search_uri (const gchar* uri, const gchar* keywords); +gchar* +sokoke_hostname_from_uri (const gchar* uri, + gchar** path); + gchar* sokoke_idn_to_punycode (gchar* uri);