João Rosado wrote:
João,
Adding to your answer: in my case, I had to specify the encoding as "utf-8" when using the BinaryDataToText function in order for it to work.
Thanks.
Hi João,
I know this is an old thread, but I wanted to set some things straight here.
The source that is mentioned here as saying that "ISO-8859-1 is the default for HTTP" dates from 2006 and probably talks only about the default for text media types.
Indeed, before 2014, ISO-8859-1 was the default encoding for any text media types such as text/html, text/plain, ... (source).
Quote from the RFC 2616 spec:"When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP"
Then in 2014, the RFC 7231 spec changed this to:"The default charset of ISO-8859-1 for text media types has been removed; the default is now whatever the media type definition says." (see Appendix B)
So that means that the default charset for application/json (as used in REST) should be defined by the JSON spec (RFC 8259), which, in section 8.1 says:
"JSON text exchanged between systems that are not part of a closed ecosystem MUST be encoded using UTF-8"
Conclusion:
ISO-8859-1 is NOT, and probably never has been, the default encoding for Content-Type application/json. So this seems to be an incorrect implementation of the HTTP spec by OutSystems.
Kind regards,
Steven
We just encountered this problem. thanks for the solution/answer.
Small addition:
The TextToBinary must contain the charset/encoding of the supplying system.
For us this was ISO-8591-1.
This is ofcourse a very bad way to decode: We only use the binary conversion util to translate encoded text.
Using the BinaryDataToText, I did set encoding input to utf-8 and it worked.
Hello,
I'm facing very similar issue. Although at first sight I thought it solved my issue, I found some cases where encoding is still incorrect (see below example)
If I didn't use the OnAfterResponse and convert the encoding, second row also had issues, but after the change you can see that first example is still wrong...
Any ideas? :)