Reputation: 11
I am working on a Web Service, in which the URL is given with 2 inputs-- input1 & input2 such as . The input2 contains a slash within it like onj\hjk. When I hit the URL, it is considering as 3 input parameters which is supposed to be only 2. Can you please let me know how to handle this situation and how the code has to be changed accordingly
Upvotes: 0
Views: 63
Reputation: 2020
If you are generating the URLs from Javascript then use either encodeURIComponent(str)
or encodeURI(str)
.
But in case your are generating URLs through PHP then use urlencode()
.
For details visit urlencode() and encodeURI(uri)
Upvotes: 1