REST encoding problem

REST encoding problem

  
Hi,

I'm consuming a REST web service from a client and the data returned has accents and other special characters. When the data has accents or special characters I get question marks where the characters should be. I believe this is a encoding problem.
Can I set the encoding of a REST? 

I'm attaching a screenshot.

Thanks!
Solution
Hi Victor,

The REST respects the character set specified in the response, so if for example the encoding is in UTF-8 the client needs to reply with "content-type:application/json;charset=UTF-8".
The platform by default assumes the default specified in the HTTP spec (ISO-8859-1) and not UTF-8 as some services assume the default is, so it can cause problems like that.

You can try to use a OnAfterResponse to:
  • and read it ResponseBinary
  • use the BinaryDataToText action from the BinaryData extension
  • set the result into the ResponseText



I'm not sure 100% if the ResponseBinary is filled when the output of the method is not a binary...
Edit: just tested and it's filled corretly, so you should have no problem doing this.


Tell me if you get it working.

Regards,
João Rosado


Solution