diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2018-08-15 18:20:18 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2018-08-15 18:20:18 +0100 |
commit | b46f1257c3db75cdaa0794f96e3802f4c13bb4e6 (patch) | |
tree | 4548612fc5d180f9810c31c116ff981cb63af424 | |
parent | 7964629914cd955a48c3ed52e27cf79ee1ece3f6 (diff) | |
download | netsurf-b46f1257c3db75cdaa0794f96e3802f4c13bb4e6.tar.gz netsurf-b46f1257c3db75cdaa0794f96e3802f4c13bb4e6.tar.bz2 |
Convert user/pass to UTF-8 for submission
-rwxr-xr-x | frontends/amiga/login.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c index e4965e393..3ebae1867 100755 --- a/frontends/amiga/login.c +++ b/frontends/amiga/login.c @@ -46,8 +46,10 @@ #include "amiga/gui.h" #include "amiga/libs.h" -#include "amiga/object.h" #include "amiga/login.h" +#include "amiga/misc.h" +#include "amiga/object.h" +#include "amiga/utf8.h" enum { AMI_LOGIN_MSG_HOST, @@ -78,7 +80,7 @@ static void ami_401login_close(void *w); static const struct ami_win_event_table ami_login_table = { ami_401login_event, - ami_401login_close, + ami_401login_close, /* TODO: investigate why this doesn't get called on exit */ }; nserror gui_401login_open(nsurl *url, const char *realm, @@ -215,13 +217,20 @@ static void ami_401login_close(void *w) static void ami_401login_login(struct gui_login_window *lw) { - ULONG *user,*pass; + char *user; + char *pass; GetAttr(STRINGA_TextVal,lw->objects[GID_USER],(ULONG *)&user); GetAttr(STRINGA_TextVal,lw->objects[GID_PASS],(ULONG *)&pass); - /* TODO: Encoding conversion to UTF8 for `user` and `pass`? */ - lw->cb(user, pass, lw->cbpw); + char *user_utf8 = ami_to_utf8_easy(user); + char *pass_utf8 = ami_to_utf8_easy(pass); + + if(user_utf8 && pass_utf8) { + lw->cb(user_utf8, pass_utf8, lw->cbpw); + } else { + amiga_warn_user("NoMemory", ""); + } /* Invalidate continuation */ lw->cb = NULL; |