Allow setting request encoding for RestBuilder
Opened this issue · 6 comments
snowindy commented
Request currently send requests in default encoding ISO-8859-1 specified in StringHttpMessageConverter
To enable custom encoding, I had to use a hack:
RestBuilder rest = new RestBuilder()
rest.restTemplate.setMessageConverters([new StringHttpMessageConverter(Charset.forName("UTF-8"))])
RestBuilder needs a better and more obvious way to customize request encoding.
gabrielgambarini commented
Thanks for posting the hack!
fragsalat commented
+1
aruizca commented
+1
ggajos commented
provided workaround at the top of this conversation is replacing all message converters, so use carefully
In my case passing custom header with charset resolved my issue:
header('Content-Type', 'application/xml;charset=UTF-8')
GSantanaPortel commented
For me only work like this:
def rest = new RestBuilder()
rest.restTemplate.setMessageConverters([new StringHttpMessageConverter(Charset.defaultCharset.forName("UTF-8"))])
sufyanshoaib commented
thanks
@snowindy .. worked for me