JS Unicode Encoding Problem after Update to 9.2.101.1295

I am calling my Delphi-RO Server from a JavaScript client via JSONMessage. I always use WideString for my string-types. It all worked perfect under 9.1.99.1273. But since I updated to 9.2.101.1295 I get a Encoding Exception in my server.

This happens in this case:
In my JS-Client I have a form for entering some data. If I type unicode characters like “€” I get a EEncodingError Exception after posting this to the server. This happens only after updating to the new version! Previous works.
I also tested the current alpha release - same issue.

The German Exception message is:
“Exception-Klasse EEncodingError mit Meldung ‘Keine Zuordnung für Unicode-Zeichen in der Multibyte-Zielcodeseite vorhanden’.”

The error seems to happen in:
TROJSONValue.LoadFromStream
at this line: w := UTF8BytesToString(@s[i], Length(s)-i);
This goes into: System.SysUtils -> TEncoding.GetString

I changed nothing from the previous ROSDK Version. I am using Delphi Berlin.

This is very urgent for me. Currently I am not able to switch to the new RO-Version / Delphi Tokyo.

if you change TROJSONMessage.Encoding to UTF16LE, will it solve this issue?

can you post example of such JSON request to support@ pls?

Same issue with UTF16LE, UTF16BE, …

I will send you the JSON Request now at support@

Do you already have new information for this? Have you got my E-Mail?

I’ve replied to it 6 days ago. check, probably it was put into spam folder …


according to https://www.w3schools.com/charsets/ref_utf_currency.asp , should be encoded in UTF8:

Char 	Dec 	Hex 	Entity 	Name
€	8364	20AC	€	EURO SIGN

so it was passed incorrectly

Thanks.

But shouldn’t the encoding be done by RemObjectsSDK.js? It worked in the previous Version of ROSDK.

this bug is reproduced only with Indy-based servers - they return request only as string and don’t as binary data.
as a result, UTF8 decoding was broken.
as a workaround, you can use others HTTP servers or use this fix for uROIndyHTTPServer.pas:

procedure TROIndyHTTPServer.InternalServerCommandGet(AThread: TIdThreadClass;
  RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo);
var
  {$IFDEF UNICODE} k: TBytes; {$ENDIF} //added
..
      {$IFDEF UNICODE} // this code block was added
      aRequestStream := TROBinaryMemoryStream.Create();
      if reqdata <> '' then begin
        k := BytesOf(reqdata);
        aRequestStream.Write(k[0],Length(k));
        aRequestStream.Position := 0;
      end;
      {$ELSE}
      aRequestStream := TROBinaryMemoryStream.Create(reqdata);  // existing line
      {$ENDIF}    

Thanks, logged as bugs://77928

bugs://77928 got closed with status fixed.