Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Escapes in JSON
Thu, Sep 1 2016 7:25 AMPermanent Link

Matthew Jones

We visited this in
http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_beta&page=1&msg=48#48
but UnEscapeStr does not yet handle the escapes in 2.5 of
http://www.ietf.org/rfc/rfc4627.txt

I currently process the output of .Net's JSON using:

 case cChar of
 'n': Result := Result + #13; // #10;
 't':Result := Result + #8;
 'r':Result := Result + #13;

which I think is all I actually need, and adapts the #10 to something
useful in the browser.

My question though is about expectation - is this something on the
near-term fix list (< 4 weeks), or should I just carry on working
around it until 2.6 at some point? I realise you have many priorities...

--

Matthew Jones
Thu, Sep 1 2016 8:54 AMPermanent Link

Matthew Jones

Matthew Jones wrote:

> I currently process the output of .Net's JSON using:
>
>   case cChar of
>   'n': Result := Result + #13; // #10;
>   't':Result := Result + #8;
>   'r':Result := Result + #13;

Anyone spot the deliberate mistake? A tab is #9...

Anyway, adding this to TParser.ParseString makes it work better for me.

           'n':
              begin
              FTokenString:=(FTokenString+#13);
              Inc(FPos);
              end;
           't':
              begin
              FTokenString:=(FTokenString+#9);
              Inc(FPos);
              end;
           'r':
              begin
              FTokenString:=(FTokenString+#13);
              Inc(FPos);
              end;


I think that UnEscapeStr should also have:
           'n':
              begin
                   Remove(I-1,1);
                   Chars[I] := #13;
              end;
           't':
              begin
                   Remove(I-1,1);
                   Chars[I] := #9;
              end;
           'r':
              begin
                   Remove(I-1,1);
                   Chars[I] := #13;
              end;
but that isn't used by the JSON parser so untested.

--

Matthew Jones
Image