Reputation: 524
I am sending request to server by using this following url format
http://api.xyz.com/JSonService.asmx/Category_Name=food-and-drink
.
But my problem is i am not able to send the request as hyphen present in food-and-drink,but in my system browser it is working fine..
Thanks in advance.
Upvotes: 2
Views: 2349
Reputation: 20041
You need to use URLEncoder
String queryStr = URLEncoder.encode("food-and-drink", "utf-8");
String urlStr = "http://api.xyz.com/JSonService.asmx/Category_Name=" + queryStr;
Upvotes: 1