android - Wierd results while trying to build an URI for HTTPGET -


i'm trying build url adding parameters baseurl: problem parameters added baseurl in disorder, , characters é replaced weird stuffs %c3%a9

string baseuri="mybaseuri"; void getparameters() {     hashmap<string, string> map=new hashmap<string, string>();                  final string login = ((edittext)alertdialogregister.findviewbyid(r.id.reglogin)).gettext().tostring();    final string password= ((edittext)alertdialogregister.findviewbyid(r.id.regpassword)).gettext().tostring();    final string passwordconfirm= ((edittext)alertdialogregister.findviewbyid(r.id.regpasswordconfirm)).gettext().tostring();    final string firstname= ((edittext)alertdialogregister.findviewbyid(r.id.regprenom)).gettext().tostring();    final string lastname= ((edittext)alertdialogregister.findviewbyid(r.id.regnom)).gettext().tostring();        final string sexe=((radiobutton)alertdialogregister.findviewbyid(((radiogroup)alertdialogregister.findviewbyid(r.id.regsexe)).getcheckedradiobuttonid())).gettext().tostring();    final string email= ((edittext)alertdialogregister.findviewbyid(r.id.regemail)).gettext().tostring();    final string telephone= ((edittext)alertdialogregister.findviewbyid(r.id.regphone)).gettext().tostring();    final string adresse= ((edittext)alertdialogregister.findviewbyid(r.id.regaddress)).gettext().tostring();    final string civilite=((radiobutton)alertdialogregister.findviewbyid(((radiogroup)alertdialogregister.findviewbyid(r.id.regcivilite)).getcheckedradiobuttonid())).gettext().tostring();     map.put("rquest","adduser");     map.put("login", login);     map.put("password", password);     map.put("firstname", firstname);     map.put("lastname", lastname);     map.put("sex", sexe);     map.put("situation", civilite);     map.put("email", email);     map.put("address", adresse);     registeruser(map);  } 

 public void registeruser(hashmap<string,string> map)     {           uri.builder builder = uri.parse(baseuri).buildupon();         builder.appendpath("api.php");         for(map.entry<string, string> entry:map.entryset())         {         builder.appendqueryparameter(entry.getkey(),entry.getvalue());         }         uri builturi = builder.build();         log.i("hossam", builturi.tostring());         httpclient httpclient = new defaulthttpclient();           httpget request = new httpget(builder.tostring());            responsehandler<string> handler = new basicresponsehandler();           string result = null;         try {               result = httpclient.execute(request, handler);           } catch (clientprotocolexception e) {               e.printstacktrace();           } catch (ioexception e) {               e.printstacktrace();           }           httpclient.getconnectionmanager().shutdown();           string tag = null;         //log.i("http response", result);       } 

the order issue, because using map, , in java maps unordered , unsorted type of collection, unless use either linkedhashmap or treemap cost way more in performance regular list, if want specific order must go list, other way map return values in unordered way, , related special characters because url contains them, , default url coneverted encoded version of them since can ascii, here list of url encoded characters... http://www.degraeve.com/reference/urlencoding.php


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -