android - Keep getting "Target host must not be null, or set in parameters" -
i keep getting error above (title) when try make http-request server special character (the character 'å'). have tried call:
_login = urlencoder.encode(_login, "utf-8");
but still exception. if try change url works fine. seems happends whatever url try if has special characters. example http://www.ål.no
.
anyone know work-around? 1 way of course use ip-address. rather avoid that.
thanks help!
some of source code:
private string _login = "http://www.ål.no"; httpclient httpclient = new defaulthttpclient(); try { _login = urlencoder.encode(_login, "utf-8"); } catch (unsupportedencodingexception e1) { // todo auto-generated catch block e1.printstacktrace(); } httppost httppost = new httppost(_login); list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); //namevaluepairs.add(new basicnamevaluepair("mail", this.email)); //namevaluepairs.add(new basicnamevaluepair("password", this.password)); try { httppost.setentity(new urlencodedformentity(namevaluepairs)); basichttpresponse response = null; try { response = (basichttpresponse) httpclient.execute(httppost); } catch (clientprotocolexception e) { system.out.println("basichttpresponse"); e.printstacktrace(); } }
edit: found work around. used firebug dig little deeper. according firebug server has name when communicating (as far can see). name not contain special characters , managed communicate server using application. help! :)
i think understand you're asking for. here link list of special characters url identify.
http://www.degraeve.com/reference/urlencoding.php
if thats not need let me know.
to save time, character you're searching %e5
Comments
Post a Comment