0

I have been trying to use accent characters in URL to call SOLR. My Url looks like this:

    "http://host:8983/solr/principal/select?q=**name:%22Michaël.e%22**"

When fire the URL from browser I get the correct result but when try from RestTempalte.exchange(URI,HttpMethod.GET, entity, String.class) The log I see on SOLR is showing the accent characters being coverted to "?" as shown below

q=(name:"Micha?.e")

I have set RestTemple request charSet to "UTF-8" it still does the same.

My SOLR is running on Jetty.

prasad
  • 13
  • 7

1 Answers1

0

You can try to encode HTML characters before calling RestTemplate using URLEncoder

String baseUri = "http://host:8983/solr/principal/select?q=**name:%22";
// TODO get name from somewhere
String name = "Michaël.e";
String encodedName= = URLEncoder.encode(name, "UTF-8");

RestTempalte.exchange(baseUri + encodedName + "%22**",HttpMethod.GET, entity, String.class);
Magic Wand
  • 1,572
  • 10
  • 9