issue about TTMSFNCPersistence.LoadSettingsFromStream & SaveSettingsToStream

Hi There,

We updated both TMS Web core and FNC libraries to its latest today, and found issues for both .LoadSettingsFromStream and SaveSettingsToStream functions.

Here is a demo to explain the issues. I created a simple instance that has two variables, we would like to read & write JSON string into the instance. An error was observed when reading the JSON from memo:
Name expected | fMessage::Name expected fHelpContext

I also got an error when writing the instance as a JSON data, it converted to:
≻琤灹≥∺䅔灰敬Ⱒ䴢摩汤乥浡≥∺潒≢∬慎敭㨢刢杯牥索

Could you please take a look at the issues, we have quite a lot places in our project where these two functions are used. Thanks in advanced.

3. JSon issue.zip (1.8 MB)

Hi,

There were internal issues with encoding, please use TStringStream.Create(WebMemo1.text, TEncoding.UTF8); to read and TStringStream.Create('', TEncoding.UTF8); to write. Alternatively, you can also simplify the code to:

uses
  WEBLib.TMSFNCTypes;

procedure TForm1.WebButton1Click(Sender: TObject);
var
  anApple :TApple;
begin
  anApple := TApple.create;
  anApple.JSON := WebMemo1.Text;
  showmessage(anApple.Name);
  anApple.free;
end;

procedure TForm1.WebButton2Click(Sender: TObject);
var
  anApple :TApple;
begin
  anApple := TApple.create;
  anApple.Name := 'Roger';
  anApple.MiddleName := 'Rob';
  WebMemo1.text :=  anApple.JSON;
  anApple.free;
end;

Thanks! That works!