I'm migrating to PowerBuilder 2022.
This is a phrase I used previously.
blob ab_data
FileOpen(as_filename,StreamMode!,Write!,LockWrite!,Replace!,EncodingANSI!)
ls_body = 'aaaa'
ab_data = blob(ls_body,EncodingANSI!)
IF FileWriteEX(li_FileNum, ab_data) = -1 THEN
MessageBox("Error", "Write Error")
FileClose(li_FileNum)
return false
END IF
As above, with EncodingAnSi!
Define the format and create the file
There is no text in the file.
Encodingutf8! If you do this, the file will be created normally.
Why is the logic that worked well in 2019 not working?
 is the UTF-8 BOM bytes interpreted as Windows-1252 (widely but incorrectly known as "ANSI") character data, which proves that FileOpen() does open the file just fine but rejects it based on the first three bytes despite the actual text encoding being "ANSI".
BTW: I encountered this windows O/S phenomenon way back in the W95 days. AFAIK it's still the same in W11.