summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-03-13 19:37:01 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-03-13 19:37:01 +0000
commitc44bbcdc08b880bead0a196826d64031de36bee6 (patch)
tree072486c91acf7a2171c941c552e3d8afdbcbdb1a /amiga
parent7a3d3437663ea6669811910f7671600d861a2f1f (diff)
downloadnetsurf-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')
-rwxr-xr-xamiga/dist/NetSurf.guide5
-rw-r--r--amiga/gui.c30
-rwxr-xr-xamiga/gui_options.c7
3 files changed, 28 insertions, 14 deletions
diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide
index 25310bdc1..5aaf60aa3 100755
--- a/amiga/dist/NetSurf.guide
+++ b/amiga/dist/NetSurf.guide
@@ -183,6 +183,7 @@ Commands are:
@{b}OPEN URL/A,NEW=NEWWINDOW/S,NEWTAB/S,SAVEAS/K,W=WINDOW/K/N,T=TAB/K/N@{ub}
Opens URL in current window or a new window/tab if NEWWINDOW/NEWTAB is specified. Saves the location without displaying if SAVEAS and a filename is specified (SAVEAS available in 2.6325)
+Note that if the URL is non-ASCII it is expected to be encoded in UTF-8 (file: references should always be in local charset due to filesystem limitations). Usually this is not relevant, as all normalised URLs will be in their ASCII form.
@{b}SAVE FILENAME/A,W=WINDOW/K/N,T=TAB/K/N@{ub} (2.6027)
Saves current page source to FILENAME
@@ -255,6 +256,10 @@ Under OS4.1 Update 1, launch-handler is used in preference to OpenURL. The
Installer script can add the relevant configuration to launch URLs in NetSurf.
Please ensure your email application is configured in URL Prefs for mailto:
links clicked within NetSurf.
+
+Note that a helper script is installed in S:ARexx which can be used instead of
+the main executable, to stop the NetSurf executable from being loaded again if
+it is already running.
@endnode
@node hotlist "Hotlist menu"
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;
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index b969eb8c8..400ced8a5 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -410,6 +410,8 @@ void ami_gui_opts_open(void)
BOOL download_notify_disabled = FALSE;
BOOL ptr_disable = FALSE;
char animspeed[10];
+ char *homepage_url_lc = ami_utf8_easy(nsoption_charp(homepage_url));
+
struct TextAttr fontsans, fontserif, fontmono, fontcursive, fontfantasy;
if(gow && gow->win)
@@ -557,7 +559,7 @@ void ami_gui_opts_open(void)
LAYOUT_AddChild, gow->objects[GID_OPTS_HOMEPAGE] = StringObject,
GA_ID, GID_OPTS_HOMEPAGE,
GA_RelVerify, TRUE,
- STRINGA_TextVal, nsoption_charp(homepage_url),
+ STRINGA_TextVal, homepage_url_lc,
STRINGA_BufferPos,0,
StringEnd,
CHILD_Label, LabelObject,
@@ -1529,6 +1531,7 @@ void ami_gui_opts_open(void)
gow->node = AddObject(window_list,AMINS_GUIOPTSWINDOW);
gow->node->objstruct = gow;
}
+ ami_utf8_free(homepage_url_lc);
}
void ami_gui_opts_use(bool save)
@@ -1543,7 +1546,7 @@ void ami_gui_opts_use(bool save)
ami_update_pointer(gow->win, GUI_POINTER_WAIT);
GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_HOMEPAGE],(ULONG *)&data);
- nsoption_set_charp(homepage_url, (char *)strdup((char *)data));
+ nsoption_set_charp(homepage_url, (char *)ami_to_utf8_easy((char *)data));
GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_CONTENTLANG],(ULONG *)&data);
nsoption_set_charp(accept_language, (char *)strdup((char *)data));