I'm sending a GET request with HttpClient but the + is not encoded.
1.
If I pass the query parameter string unencoded like this
URI uri = new URI(scheme, host, path, query, null);
HttpGet get = new HttpGet(uri);
Then the + sign is not encoded and it is received as a space on the server. The rest of the url is encoded fine.
2.If I encode the parameters in the query string like this
param = URLEncoder.encode(param,"UTF-8");
Then I get a bunch of weird symbols on the server, probably because the url has been encoded twice.
3.If I only replace the + with %B2 like this
query = query.replaceAll("\\+","%B2");
Then %B2 is encoded when the GET is executed by HttpClient
How can I properly encode Get parameters with Apache HttpClient and make sure the + is encoded as well?