Here I am calling a REST webservice using CamelCxf rsClient. The webservice returns a JSON response with encoding : ISO-8859-1. And CamelCxf is trying to read it in that encoding which is changing the French characters in json string.
I wanted to change the charset encoding to UTF-8 to read both English and French characters.
I have tried to read the cxfrs client response as
<convertBodyTo type="String"/>
Which changed the French character è to é
I have also tried to convert the response into byte[] and then created a UTF-8 string from the byte[]
<convertBodyTo type="byte[]"/>
and in the processor
byte[] body =(byte[]) exchange.getIn().getBody();
String convertedString = new String(body, "utf8");
This attempt also failed to read french characters properly.
Response headers from external webservice
Content-Type: application/json
Encoding: ISO-8859-1
How do we make camel Cxf rsClient to ignore the encoding coming with json response and change to
Content-Type: application/json;charset=UTF-8
Encoding: UTF-8
Can we use an interceptor to do so?
Update :
Tried
<convertBodyTo type="java.lang.String" charset=UTF-8"/>
It works in local windows server but NOT in remote redhat Linux servers.