encoding - What's the best way to url encode only query keys and params in Java? -


i encode query keys , parameters of url (don't want encode /, ? or &). what's best way in java?

for example, want convert

http://www.hello.com/bar/foo?a=,b &c =d

to

http://www.hello.com/bar/foo?a=%2cb%20&c%20=d

build url this:

string url = "http://www.hello.com/bar/foo?"; url += "a=" + urlencoder.encode(value_of_a); url += "&c=" + urlencoder.encode(value_of_c); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -