I am using Java Spring Resttemplate to get json via get request. Query parameter values can contain Russian characters. In such cases, I do not receive data from the API.
My code:
URI uri = UriComponentsBuilder.fromHttpUrl(url)
.path("/resume")
.queryParam("text", "Java-разработчик")
.build()
.toUri();
log.info("URI: " + uri);
logs:
https://api.link.com/resume?text=Java-%D0%A1%D0%82%D0%A0%C2%B0%D0%A0%C2%B7%D0%A1%D0%82%D0%A0%C2%B0%D0%A0%C2%B1%D0%A0%D1%95%D0%A1%E2%80%9A%D0%A1%E2%80%A1%D0%A0%D1%91%D0%A0%D1%94
I also tried this, but it didn't help:
1)
restTemplate.getMessageConverters()
.add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));
2)
URI uri = UriComponentsBuilder.fromHttpUrl(url)
.path("/resume")
.queryParam("text", URLEncoder.encode("Java-разработчик", HTTP.UTF-8))
.build()
.toUri();
What can be done so that Russian characters do not change and the request is sent directly with them?
That is, in the end, the request should look like this:
https://api.link.com/resume?text=Java-разработчик
