delphi 10.4.1
R.O: 10.0.0.1495
I used the below customreposeEvent to handle the parameter however it cant read chinese data correctly, Seems the decoding not correct.
Please advise how to fix and read all uniicode encoding string.
procedure TServerDataModule.ROServerCustomResponseEvent(
const aTransport: IROHTTPTransport; const aRequestStream,
aResponseStream: TStream; const aResponse: IROHTTPResponse;
var aHandled: Boolean);
var
lMessage: IROMessage;
op: TROResponseOptions;
s: AnsiString;
b: TBytes;
boJson :TsgcJSON;
begin
SetLength(s, aRequestStream.Size);
aResponseStream.Position := 0;
aRequestStream.Read(Pointer(s)^, Length(s)); //check body skipped
lMessage:= (ROJSONMessage1 as IROMessageCloneable).Clone;
boJson := TsgcJSON.Create(Nil);
boJson.Read(s);
boJson.AddPair('in_data',TNetEncoding.Base64.Encode(boJson.Text));
b := StringToUTF8Bytes(boJson.Text);
aRequestStream.Size := 0;
aRequestStream.Write(b[0], Length(b));
aResponseStream.Position := 0;
aRequestStream.Position := 0;
ROHttpApiDispatcher1.Process(aTransport, aTransport as IROHTTPRequest, aResponse, aRequestStream, aResponseStream);
FreeAndNil(boJson);
aHandled := True;
end;
end;