LoadStringFromFile

342 views
Skip to first unread message

Anderson Fiori

unread,
Mar 30, 2021, 9:17:51 AM3/30/21
to innosetup
How can I read this file correctly?
In the first image, I am running in the setup.
But I would like it to be the same as the second.

https://ibb.co/0KB7c8V

Anderson Fiori

unread,
Mar 31, 2021, 5:05:24 AM3/31/21
to innosetup
Possibly there is a bug in reading the file, because I did a reading test with a TStringList and the data was returned correctly.

Ps: The same error happens with LoadStringFromFile and LoadStringsFromFile

Eivind Bakkestuen

unread,
Mar 31, 2021, 7:06:42 AM3/31/21
to inno...@googlegroups.com
You're not saying if you are using the unicode Inno version or not, and not spelling out what character set your file is saved as.

There's likely a mismatch between Inno version and the character set your file is saved as.

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/ed110e59-5d38-43e3-a708-bf3fcd225ec9n%40googlegroups.com.

Anderson Fiori

unread,
Mar 31, 2021, 10:43:35 AM3/31/21
to innosetup
This is a code snippet that I found on google

TempFilename := ExpandConstant('{tmp}\result.txt');
  
  { Exec via cmd and redirect output to file. Must use special string-behavior to work. }
  Command := Format('"%s" /S /C ""%s" %s > "%s""', [ExpandConstant('{cmd}'), Filename, Params, TempFilename]);
  Result := Exec(ExpandConstant('{cmd}'), Command, WorkingDir, ShowCmd, Wait, ResultCode);

Martijn Laan

unread,
Mar 31, 2021, 11:24:54 AM3/31/21
to inno...@googlegroups.com
Op 30-3-2021 om 15:17 schreef Anderson Fiori:
How can I read this file correctly?

As the LoadStringFromFile help says it "loads the specified binary or non Unicode text file into the specified string". Your file is Unicode, so what you're seeing is the exact Unicode encoding in the file, including the BOM etc.

Greetings,
Martijn
Reply all
Reply to author
Forward
0 new messages