I'm using Unicode SynEdit, which (in theory) has basic file/stream encoding detection. It worked fine until I tried opening the file which was generated by my PHP script. The file I'm talking about is detected by UniSynEdit as utf8 with no BOM. Unfortunately, it doesn't open - the loaded string is empty. I debugged it, and it seems that the problem is the function Utf8Decode, which fails for some reason and returns empty string. I've also checked the file with hex editor, and it's true: it has no BOM, all the normal characters are encoded using one byte, while some polish letters I had in the file (like "ł") are double-byte...
What could be wrong, and how can I prevent this? I believe wrong encoding loaded is better than no file at all...