Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Using Encoding in TLMDIniCtrl

I wanted to try out encoding a string in the INICtrl so I did a simple test app:

procedure TForm1.Button1Click(Sender: TObject);
begin
  LMDINICtrl1.WriteString('MySect','Name','Welcome to LMD');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 Edit1.text := LMDINICtrl1.ReadString('MySect','Name','NA');
end;

I used the default Encoding settings, I just turn Encoded ON and set Cryptmode : icmTextKey
There is an encoded string written: 24:Inno_BL0kknm<To__kd:JlFKkknmkknm
But when I read the string back out it seems to be even more encoded : W#��=��2��C�&��^8�2� 
Is there something else I need to do read decoded data back out?

Comments

  • 6 Comments sorted by Votes Date Added
  • Thanks for report. Need some time to check.
  • Hi, I've checked and it works fine at my side. Can you please send a simple test project to our support e-mail? Also, please provide information about your IDE and LMD packages versions.
  • Hi Eugene,
    I made a very simple example (attached) and tried the exe on my laptop and it works fine there, it's just on my main PC that it goes wrong :-( My main PC is Windows 11 with Delphi 12 and LMD 2024.1)
    I also tried compiling the code on the laptop (also Windows 11) in both Delphi 12 (LMD 2024.1) and Delphi XE3 (LMD 2019.11). Both versions work fine on the laptop but not on my main PC. I did also restart the main PC just in case that was the problem, no change... Maybe I just need a new desktop PC - again :-(
    zip
    zip
    Project1.zip
    115K
  • Posts: 0 Accepted Answer Vote Up0Vote Down
    I've tried your demo and it also works fine at my side. However, I've realised that the component use convertion to AnsiString, which can depend of Windows settings. 

    I will add UTF-8 based conversion...
  • I've added LMDUseUTF8ForEncoding boolean gloabal variable to LMDStrings.pas unit. Set it to True at the start of your app. Also, I've made some rework of encode/decode functions, so there is a (small) chance that they will work without this new variable.

    If you can work with sources, write me to our support e-mail, I will send you modified source file (LMDStrings.pas) for testing.
  • Thanks, but I will wait for the next source-less release. 
Sign In or Register to comment.