#1 2018-03-12 20:03:25

hnb
Member
Registered: 2015-06-15
Posts: 291

ToTextPairs and InitCSV problem

Hi,

seems that we have small problem. The data which is saved by :

SomeVar.test := 'test';
LIni := TDocVariantData(SomeVar).ToTextPairs;

and after is loaded:

TDocVariantData(SomeVar).InitCSV(LIni);
WriteLn(SomeVar.test) // print "test"
LIni := TDocVariantData(SomeVar).ToTextPairs;
TDocVariantData(SomeVar).InitCSV(LIni);
WriteLn(SomeVar.test) // print "\"test\""

works improper (the documentation says : the supplied content may have been generated by ToTextPairs() method). The SomeVar.test contains improper string (encoded JSON string).

The partial solution is:

LIni := TDocVariantData(SomeVar).ToTextPairs('=', #13#10, twNone);

but this is not the point. Probably some additional parameter for InitCSV is needed.


best regards,
Maciej Izak

Offline

#2 2018-03-12 21:10:59

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

Re: ToTextPairs and InitCSV problem

Offline

#3 2018-03-15 10:55:34

hnb
Member
Registered: 2015-06-15
Posts: 291

Re: ToTextPairs and InitCSV problem

Rather no. InitCSV don't decode, encoded string by ToTextPairs with twJSONEscape option (there is no way to use in proper way InitCSV when twJSONEscape was used in ToTextPairs).


best regards,
Maciej Izak

Offline

Board footer

Powered by FluxBB