Page 2 of 2

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 18:18
by Ariman

Latest post of the previous page:

Files are fine. Problem is with BOM prefix. Compare first 3 bytes of script file extracted by innounp and by your module in hex view. Version from innounp contains UTF BOM sequence in first 3 bytes. They help editors to correctly identify file encoding. If you open script file in Far's File Viewer it will automatically switch to 65001 codepage (utf-8). Script file extracted by module contains some other 3 bytes at the beginning and Viewer can not understand what codepage should be used.

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 18:21
by pepak
I believe my module works correctly - it extracts the file with the BOM, then FAR automatically detects this BOM, switches to the 65001 codepage and hides the BOM. Manually switch to an 8-bit codepage such as 1252, then you will see the BOM.

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 18:34
by pepak
Made an additional check, comparing files from my module to the files from the official InnoUnp (not my InnoUnp). The reconstructed script and most of the files are the same, but there is a difference in some of the .isl files. I will research those. Also, license.txt got converted to UTF16, but I think that's an acceptable change. Other than that, the files seem to be the same.

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 18:42
by Ariman
Ok. To simplify the explanation here is the screenshot.
script-bom.png
File with _exe suffix is one from official innounp and file with _mod suffix is from the module. First 3 bytes are different.
Correct UTF BOM is 0xEF,0xBB,0xBF (https://en.wikipedia.org/wiki/Byte_order_mark). File from module does not have correct bytes.

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 18:49
by pepak
The problem is, that correct BOM is exactly what I am getting from the module!

I will need to check the work with non-ASCII characters, due to that difference in .isl files. Perhaps it is somehow related to your incorrect BOM, too. Or not. It will be difficult for me to verify because I am getting the correct values.

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 19:37
by Ariman
Strange. Out of curiosity I tried both x86 and x64 versions of Far3 and got invalid BOM in both cases. Not sure why we could have different results for the same file.

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 19:53
by pepak
Given the differences in .isl files, my guess is some uninitialized variable in UTF8 encode. Strange that there is no warning in Delphi, though, and more strange that there were no such reports in older Delphi versions - it could also be a bug in Delphi 10.3 Rio. We shall see.

InnoSetup module for Observer

Posted: Tue 01 Jan, 2019 20:26
by Ariman
Ah, I get it now. I've checked your sources and I think that in your version script text goes through unicode->ansi conversion.
I use Delphi7 where String == AnsiString, you use 10.3 where String == UnicodeString. TBigString class uses String type. In your version it is Unicode string and script text does double conversion: ansi->unicode in TBigString and uncode->ansi inside RebuildScript. In my version there is no such thing because both string types are AnsiString. And on different locales (I guess we have different ones) unicode-ansi convertion produces different results. That is why we see different output.
I suggest to fix TBigString to use AnsiString type explicitly. Since .isl files created with TBigString too I guess they have same issue.

InnoSetup module for Observer

Posted: Wed 02 Jan, 2019 19:14
by pepak
Hmm. I may end up doing just that, but only as a last resort. I would much prefer to convert the strings during read so that the "native" version reflects the Delphi used for the compilation. Then I could convert the native version back to whatever the user requires.

InnoSetup module for Observer

Posted: Fri 15 Feb, 2019 22:06
by skipik
pepak, hello, Ariman is working on a new version atm, it's Observer 1.12 and your innounp.so doesn't work there. Could you fix it please? You can get the latest binaries here: viewtopic.php?p=152643#p152643 and source code is here: https://github.com/lazyhamster/Observer

InnoSetup module for Observer

Posted: Sat 16 Feb, 2019 07:00
by pepak
At a glance, the modification seems simple enough. However, I am reluctant to do that until the new version of Observer is released, for fear of confusing the users.

InnoSetup module for Observer

Posted: Sat 16 Feb, 2019 20:59
by Yegor
pepak wrote:
Sat 16 Feb, 2019 07:00
I am reluctant to do that until the new version of Observer is released, for fear of confusing the users.
I, personally, agree.