Encode IDN addresses passed externally
Apparently libUnique can't handle international domains and won't pass them onto the destined instance, so we encode them beforehand.
This commit is contained in:
parent
b53c39b82e
commit
acb2104128
3 changed files with 20 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -185,7 +185,7 @@ sokoke_spawn_program (const gchar* command,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
gchar*
|
||||
sokoke_idn_to_punycode (gchar* uri)
|
||||
{
|
||||
#if HAVE_LIBIDN
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue