http://bugs.winehq.org/show_bug.cgi?id=18192
--- Comment #11 from Dmitry Timoshkov dmitry@codeweavers.com 2009-04-27 04:59:43 --- (In reply to comment #10)
I meant that, when a file is opened, Notepad has to somehow detect what encoding it is in. In my patch, I just read the first 3 bytes, and check if they are FFFExx, FEFFxx, EFBBBF, or something else. I suppose I should use IsTextUnicode, with an extra check for UTF8.
There is a working code you can reuse for that task: dlls/kernel32/profile.c, PROFILE_DetectTextEncoding().
In my patch, I use an OFNHookProc... is there a simple way to detect if the dialog it's hooking into is an Open or a Save As dialog? (Other than having two hook procedures.)
You can use the hook to store the desired encoding when saving, I don't see any reason to detect the file encoding