android - java.net.URLEncoder.encode encodes space as + but I need %20 -


this question has answer here:

as title says: encoder give me space %20 opposed +? need android. java.net.urlencoder.encode gives +

android has it's own uri class use.

e.g.

string url = uri.parse("http://www.google.com").buildupon()     .appendqueryparameter("q", "foo bar")     .appendqueryparameter("xml", "<hellö>")     .build().tostring(); 

results in

http://www.google.com?q=foo%20bar&xml=%3chell%c3%b6%3e

uri encodes characters in given string '%'-escaped octets using utf-8 scheme. leaves letters ("a-z", "a-z"), numbers ("0-9"), , unreserved characters ("_-!.~'()*") intact.

note: _-.* considered unreserved characters urlencoder. !~'() converted %21%7e%27%28%29.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -