- Daniel Vivier
- PowerBuilder
- Thursday, 12 May 2022 08:56 PM UTC
I have encountered a situation where my application is trying to open a file that turns out to be UTF16-LE with no BOM. As documented, PB's FileOpen function won't detect that and thus reads the file incorrectly.
But in the situation where I'm reading that file, I could be reading files from various sources, some of which are proper Unicode files with BOMs and some of which are missing the expected BOMs. So I certainly can't just assume it's always UTF16-LE. Could be Ansi, UTF8 (with or without BOM), or either UTF16-LE or UTF16-BE (with or without BOM).
I don't suppose anyone has any code they can share that detects the type and somehow reads any of those files correctly?
I'm also contacting the vendor supplying that file to see whether they can or will do anything about it, but I don't hold out high hopes, because they have thousands of users (at least) and I'm sure they would think any change might break things for other users.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.