#1 2013-01-28 14:51:34

DarekZ
Member
Registered: 2013-01-28
Posts: 3

mORMotHttpServer and escaping chars

Hi,

mORMotHttpServer library has been used in my HttpServer application. I’ve a problem with response which includes simple quote char in string (“). The server is making json from string and forwards as string to the client. For example:

The server (based on Project14Server.dpr):
I’ve added function TestQuotedString:

function TServiceCalculator.TestQuotedString: string;
begin
  Result := 'ABC';// OK
  Result := 'A\"B\"C';// Wrong
end;

and I call this in client:
lblResult.Caption := I.TestQuotedString;

Exception occurred after calling TestQuotedString method.
What is wrong?

Regards
Darek

Offline

#2 2013-01-28 15:04:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: mORMotHttpServer and escaping chars

I tried to reproduce it, with latest version from trunk - http://synopse.info/fossil/timeline
No problem when calling this method:

function TServiceCalculator.ToString: string;
begin
  result := 'A\"B\"C';
end;

The client application receives 'A\"B\"C', just as expected:

  if Client.Services['Calculator'].Get(I) then begin
    lblResult.Caption := IntToStr(I.Add(a,b));
    lblABC.Caption := I.ToString;
  end;

I've customized Project14ServerHttp.dpr and Project14Client.dpr

Offline

#3 2013-01-29 07:59:38

DarekZ
Member
Registered: 2013-01-28
Posts: 3

Re: mORMotHttpServer and escaping chars

When I upgraded the files to the latest version everything works fine.
Thank You a lot.

Offline

Board footer

Powered by FluxBB