1

I'm using Retrofit 1.9 and am trying to retrieve data from Yahoo API. As the REST Query link is stated there has all the spaces converted to the ASCII values, I made a string which is something like String query = "select%20*%20from" and passed it as the query parameter.

But when the request is sent, I observed that the % in the link are again converted into the corresponding ASCII value %25 resulting in the change of the request url to select%2520*%2520from.

I tried to escape the % in the string itself as String query = "select\%20*%20from" But I'm shown error "Illegal escape character in the string literal".

I couldn't find any relevant resource to solve this. I'm not sure if this is the right approach either. Please tell the solution to this issue and the right approach as well (if there's any, other than this).

T.M
  • 817
  • 11
  • 17

1 Answers1

0

Have a look at this question. Is a URL allowed to contain a space? . So basically try encoding space with a + sign.

Community
  • 1
  • 1