SQL Anywhere 18.104.22.1685
I was so sure this was such a simple thing to do... LOL
I have a database created with no encoding/collation options, so it has the default 1252LATIN1 code page.
I have a simple web service of TYPE RAW. (I am STRINGing data in a JSON format to produce the readable style the consumers of the data would like to receive).
I need to produce output of type UTF-16 or UTF-8.
When I call the web service from a browser, the encoding comes out as Windows-1252.
I have tried RETURNS LONG NVARCHAR and RETURN CSCONVERT(ls_payload, 'UTF-8') but the browser still says I have Windows-1252 encoding.
I have tried CALL sa_set_http_option( 'CharsetConversion', 'On'); to make sure and CALL sa_set_http_option( 'AcceptCharset', 'UTF-8') but the browser still says I have Windows-1252 encoding.
So I am feeling like I must be missing something basic...
asked 01 Nov '16, 12:34
There are several ways to do what you want to do...
The first thing that you are missing is that you are not telling the browser that you are sending it UTF-8 character data. To do this you need to set the Content-Type header. Example:
Next you need to make sure that you actually send UTF-8 character data. The easiest (and most easily understood) way is to convert the character data explicitly. Example:
The alternative (to setting CharsetConversion to OFF) would be to describe your result set as returning binary - charset conversion is never implicitly done on binary data. Example:
answered 01 Nov '16, 12:57