java - URISyntaxException while trying to build an httpget link -
i'm getting urisyntaxexception exception while trying following. have absolutely no idea whats causing issue. nice help. error located in last line
edittext edusername = (edittext)findviewbyid(r.id.textbox_username_register); string strusernametemp = edusername.gettext().tostring(); byte[] byteusernametemp = null; try { byteusernametemp = strusernametemp.getbytes("utf-8"); } catch(unsupportedencodingexception e) { e.printstacktrace(); } string strusername = base64.encodetostring(byteusernametemp, base64.default); edittext edpassword = (edittext)findviewbyid(r.id.passwordbox_password_register); string strpasswordtemp = edpassword.gettext().tostring(); byte[] bytepasswordtemp = null; try { bytepasswordtemp = strpasswordtemp.getbytes("utf-8"); } catch(unsupportedencodingexception e) { e.printstacktrace(); } string strpassword = base64.encodetostring(bytepasswordtemp, base64.default); edittext edemail = (edittext)findviewbyid(r.id.textbox_email_register); string stremailtemp = edemail.gettext().tostring(); byte[] byteemailtemp = null; try { byteemailtemp = stremailtemp.getbytes("utf-8"); } catch(unsupportedencodingexception e) { e.printstacktrace(); } string stremail = base64.encodetostring(byteemailtemp, base64.default); string strd = "22"; string strm = "11"; string stry = "1993"; stringbuilder builder = new stringbuilder(); httpclient client = new defaulthttpclient(); httpget httpget = new httpget(logindata.strapiurl + "adduser&username=" + strusername + "&password=" + strpassword + "&email=" + stremail + "&d=" + strd + "&m=" + strm + "&y=" + stry); // line causes error
urisyntaxexception
thrown if info not parsed while creating uri. try encoding uri
using urlencoder
.
string encodeduri = java.net.urlencoder.encode(logindata.strapiurl + "adduser&username=" + strusername + "&password=" + strpassword + "&email=" + stremail + "&d=" + strd + "&m=" + strm + "&y=" + stry,"utf-8"); httpget httpget = new httpget(encodeduri);
Comments
Post a Comment