You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Thomas Weinschenk <th...@solutions.endress.com> on 2017/05/08 04:40:58 UTC

Rest DSL - specify charset

Hi,

is there a way to specify the charset of the response?
My service returns characters like ° or ³ and some clients tend to
misinterpret these characters if the charset is not specified (UTF-8 in my
case).

If I (just) specify the bindingMode as Json as follows...

restConfiguration().contextPath(CONTEXT_PATH).port(8080).bindingMode(RestBindingMode.json);

... the result is a plain "Content-Type: application/json" in the response
header.


I added...

.setHeader(Exchange.CONTENT_TYPE, new ConstantExpression("application/json;
charset=utf-8"))

...to the route that does the trick but it feels wrong to overwrite the
content type just to specify the charset.


By the way I am using 2.18.3

Regards,
Thomas



--
View this message in context: http://camel.465427.n5.nabble.com/Rest-DSL-specify-charset-tp5798941.html
Sent from the Camel - Users mailing list archive at Nabble.com.