grails-plugins / grails-rest-client-builder

REST client plugin that uses Spring's RestTemplate
http://grails.org/plugin/rest-client-builder
Apache License 2.0
65 stars 32 forks source link

Allow setting request encoding for RestBuilder #14

Open snowindy opened 11 years ago

snowindy commented 11 years ago

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 10 years ago

Thanks for posting the hack!

fragsalat commented 10 years ago

+1

aruizca commented 9 years ago

+1

ggajos commented 9 years ago

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 8 years ago

For me only work like this:

def rest = new RestBuilder() rest.restTemplate.setMessageConverters([new StringHttpMessageConverter(Charset.defaultCharset.forName("UTF-8"))])

sufyanshoaib commented 8 years ago

thanks @snowindy .. worked for me