diff --git a/midori/main.c b/midori/main.c index 60b6ad27..834e47d5 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1772,6 +1772,22 @@ main (int argc, { /* TODO: Open a tab per URI, seperated by pipes */ /* FIXME: Handle relative files or magic URI here */ + /* Encode any IDN addresses because libUnique doesn't like them */ + i = 0; + while (uris[i] != NULL) + { + #if GLIB_CHECK_VERSION (2, 22, 0) + gchar* encoded = g_hostname_to_unicode (uris[i]); + if (encoded) + { + g_free (uris[i]); + uris[i] = encoded; + } + #else + uris[i] = sokoke_idn_to_punycode (uris[i]); + #endif + i++; + } result = midori_app_instance_send_uris (app, uris); } else diff --git a/midori/sokoke.c b/midori/sokoke.c index 35b95d5a..7d40e8d0 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -185,7 +185,7 @@ sokoke_spawn_program (const gchar* command, return TRUE; } -static gchar* +gchar* sokoke_idn_to_punycode (gchar* uri) { #if HAVE_LIBIDN diff --git a/midori/sokoke.h b/midori/sokoke.h index e2dbb210..ea23caaf 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -41,6 +41,9 @@ sokoke_spawn_program (const gchar* command, gchar* sokoke_search_uri (const gchar* uri, const gchar* keywords); +gchar* +sokoke_idn_to_punycode (gchar* uri); + gchar* sokoke_magic_uri (const gchar* uri, KatzeArray* search_engines);