Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread RTC server sending extended characters
Sat, May 13 2017 4:49 PMPermanent Link

thomh

Hi,

Using a custom RTC server with EWB and I am having problems sending extended characters (Norwegian) from the server to EWB.

In the response header I use:

 aServer.Response['Cache-Control'] := 'no-cache';
 aServer.Response['Content-Type'] := 'application/json; charset=utf-8';

and I also UTF8Encode the JSON return string.

However, in EWB the Norwegian characters are not decoded correctly.

Does anybody know how to format the response correctly so that EWB handles these extended characters?

Thanks.

// Thom
Sat, May 13 2017 6:03 PMPermanent Link

Matthew Jones

I think it has been established that you must not encode the text yourself.
Just pass back the Unicode as you want.

If that doesn't fix it, please provide some examples.

--
Matthew Jones
Sun, May 14 2017 7:06 AMPermanent Link

Walter Matte

Tactical Business Corporation


I don't have issue with my RTC server - I send strings using Utf8.

I have not used Norwegian characters, but I know French characters work properly.

Sending to EWB app - use UTF8Encode

       sRow := sRow + Format('"%s": "%s"',[sField, Utf8Encode(sValue)]);


Receiving from EWB - use UTF8Decode

        tbX.FieldByName(jafter.ValueByIndex[j].Name).AsString := UTF8Decode(jafter.ValueByIndex[j].AsString);


Walter
Mon, May 15 2017 2:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Thom,

<< However, in EWB the Norwegian characters are not decoded correctly. >>

Just to note: EWB doesn't decode anything, this is all handled by the browser via the XMLHttpRequest "class".  

The response headers from the web server response essentially determines how the browser converts the data into Unicode strings.

Tim Young
Elevate Software
www.elevatesoft.com
Image