Target host is not specified error when using urlEncode()

1
Hello, I’m using REST services in the app and I need to send a query that includes user input, so I need to encode spaces and special characters. I used replaceAll() for spaces, it works well, but for special characters, I need to use urlEncode(), however when I use it see an error “Target host is not specified” even though the link service includes https://.   What could be the reason of the error and how can I fix it?
asked
1 answers
1

You can’t encode the full url. You only have to encode the parameters of the url.

urlEncode($variable)

https://example.com/test?parameter=$variable

 

answered