Aha!
Seems I found a reason - I think groovy incorrectly handle BOM in a file header.
So, after I changed my powershell script to explicitly specify ascii/default encoding for the text output then jenkins starts to work correctly.
Thus, here is my change in powershell script:
#[...]
$PSDefaultParameterValues['*:Encoding'] = 'Default'
#[...]
function versionToFile($fn) {
" = Saving version# to [$fn] ..."
New-item $fn
"dummy=123" | out-file $fn -append -Encoding ascii
"FullVersionStr=$env:FullVersionStr" | out-file $fn -append -Encoding ascii
"ReleaseVersionStr=$env:ReleaseVersionStr" | out-file $fn -append -Encoding ascii
"BuildStarted=$env:BuildStarted" | out-file $fn -append -Encoding ascii
}
Now the same jenkins code generates following output:
* loading ini: C:\XBuild.main\build\log\ARC\version.txt ...
[Pipeline] readFile
[Pipeline] echo
= ver: 3.3.0.160; props:{dummy=123, FullVersionStr=3.3.0.160, BuildStarted=2025-04-06,16:22:12.944, ReleaseVersionStr=2020.1.1.1}
[Pipeline] echo
= ver.a: 3.3.0.160;
[Pipeline] echo
== (false) [dummy]: 123
[Pipeline] echo
= set vn: 3.3.0.160/3.3.0.160;
[Pipeline] echo
== (true) [FullVersionStr]: 3.3.0.160
[Pipeline] echo
== (false) [BuildStarted]: 2025-04-06,16:22:12.944
[Pipeline] echo
== (false) [ReleaseVersionStr]: 2020.1.1.1
[Pipeline] echo
= ver.b: 3.3.0.160;
So, now all methods of properties reading works fine!
That is very interesting.
As you can see - there are only latin letters are used and even with classic latin letters string values are compared incorrectly.
For sure - there is bug with handling Unicode files but the question is - if this bug on JDK side or in groovy?...