diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2014-03-13 19:37:01 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2014-03-13 19:37:01 +0000 |
commit | c44bbcdc08b880bead0a196826d64031de36bee6 (patch) | |
tree | 072486c91acf7a2171c941c552e3d8afdbcbdb1a /amiga/gui.c | |
parent | 7a3d3437663ea6669811910f7671600d861a2f1f (diff) | |
download | netsurf-c44bbcdc08b880bead0a196826d64031de36bee6.tar.gz netsurf-c44bbcdc08b880bead0a196826d64031de36bee6.tar.bz2 |
Ensure any user-input URLs are passed to the core in UTF-8.
Everything else, including any content of the URL bar which hasn't just been entered by the user, is assumed to be in ASCII.
NB: The exception is the ARexx OPEN command. This is because NetSurf uses the ARexx port and this command internally when multiple instances are opened.
file: addresses typed into the address bar containing non-ASCII characters will probably no loger work, but it is expected that under normal circumstances, users will either drag'n'drop files or use Project=>Open. If it becomes an issue I will work around it at a later date.
Diffstat (limited to 'amiga/gui.c')
-rw-r--r-- | amiga/gui.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/amiga/gui.c b/amiga/gui.c index 84e9dc98c..69b3c8db5 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -836,7 +836,7 @@ static void ami_gui_commandline(int *argc, char **argv) if(args = ReadArgs(template, rarray, NULL)) { if(rarray[A_URL]) { LOG(("URL %s specified on command line", rarray[A_URL])); - temp_homepage_url = (char *)strdup((char *)rarray[A_URL]); + temp_homepage_url = ami_to_utf8_easy((char *)rarray[A_URL]); } if(rarray[A_FORCE]) { @@ -949,7 +949,6 @@ static void gui_init2(int argc, char** argv) if(notalreadyrunning) { error = nsurl_create(temp_homepage_url, &url); - if (error == NSERROR_OK) { if(!first) @@ -1463,6 +1462,7 @@ void ami_handle_msg(void) struct browser_window *closedbw; struct timeval curtime; static int drag_x_move = 0, drag_y_move = 0; + char *utf8 = NULL; nsurl *url; if(IsMinListEmpty(window_list)) @@ -1788,12 +1788,13 @@ void ami_handle_msg(void) GetAttr(STRINGA_TextVal, (Object *)gwin->objects[GID_URL], (ULONG *)&storage); - if(search_is_url((char *)storage) == false) - { - storage = (ULONG)search_web_from_term((char *)storage); - } - { - if (nsurl_create((char *)storage, &url) != NSERROR_OK) { + if(utf8 = ami_to_utf8_easy((const char *)storage)) { + if(search_is_url((char *)utf8) == false) + { + utf8 = search_web_from_term(utf8); + } + + if (nsurl_create((char *)utf8, &url) != NSERROR_OK) { warn_user("NoMemory", 0); } else { browser_window_navigate(gwin->bw, @@ -1805,6 +1806,9 @@ void ami_handle_msg(void) NULL); nsurl_unref(url); } + ami_utf8_free(utf8); + } else { + warn_user("NoMemory", 0); } break; @@ -1817,8 +1821,10 @@ void ami_handle_msg(void) GetAttr(STRINGA_TextVal, (Object *)gwin->objects[GID_SEARCHSTRING], (ULONG *)&storage); - storage = (ULONG)search_web_from_term((char *)storage); - { + if(utf8 = ami_to_utf8_easy((const char *)storage)) { + storage = (ULONG)search_web_from_term(utf8); + ami_utf8_free(utf8); + if (nsurl_create((char *)storage, &url) != NSERROR_OK) { warn_user("NoMemory", 0); } else { @@ -1831,6 +1837,8 @@ void ami_handle_msg(void) NULL); nsurl_unref(url); } + } else { + warn_user("NoMemory", 0); } break; @@ -1884,7 +1892,6 @@ void ami_handle_msg(void) GetAttr(STRINGA_TextVal, (Object *)gwin->objects[GID_URL], (ULONG *)&storage); - if(nsurl_create((const char *)storage, &url) == NSERROR_OK) { if(hotlist_has_url(url)) { hotlist_remove_url(url); @@ -1893,7 +1900,6 @@ void ami_handle_msg(void) } nsurl_unref(url); } - ami_gui_update_hotlist_button(gwin); break; |